You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Ronald Tschalaer (JIRA)" <ji...@apache.org> on 2009/03/27 08:38:50 UTC

[jira] Created: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Broken double-checked-locking in EmbeddedDataSource.findDriver
--------------------------------------------------------------

                 Key: DERBY-4124
                 URL: https://issues.apache.org/jira/browse/DERBY-4124
             Project: Derby
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 10.4.2.0
         Environment: all
            Reporter: Ronald Tschalaer


org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
double-checked-locking idiom for setting the 'driver' variable. This
idiom is, however, not correct and hence the code is broken. The fix
is to remove the outer if, i.e. to always enter the synchronized block.

See also
http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton updated DERBY-4124:
-----------------------------------

    Attachment: alwaysSynchronize.diff

The proposed change seems correct to me. I removed the extra 'if'
statement and adjusted the indentation, in the attached patch.

A complete regression test run was clean.

I'm intending to commit this change.

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>            Assignee: Bryan Pendleton
>         Attachments: alwaysSynchronize.diff
>
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Rick Hillegas (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Hillegas updated DERBY-4124:
---------------------------------

    Urgency: Normal

Triaged July 2, 2009: Assigned normal urgency.

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton resolved DERBY-4124.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.6.0.0

Committed to the trunk as revision 833888.

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>            Assignee: Bryan Pendleton
>             Fix For: 10.6.0.0
>
>         Attachments: alwaysSynchronize.diff
>
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689913#action_12689913 ] 

Knut Anders Hatlen commented on DERBY-4124:
-------------------------------------------

You mean, we are not allowed to remove two lines of code? :)

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12689905#action_12689905 ] 

Myrna van Lunteren commented on DERBY-4124:
-------------------------------------------

This is an interesting observation...but I want to put in 1 cautionary comment; the stated webpage has no licensing/copyrighting info, but it's not clear to me whether the solution came from one of the mentioned articles or was found by one of the contributing/signing people.
We can't use this fix if there's a copyright on it.

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton reassigned DERBY-4124:
--------------------------------------

    Assignee: Bryan Pendleton

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>            Assignee: Bryan Pendleton
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Ronald Tschalaer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12693615#action_12693615 ] 

Ronald Tschalaer commented on DERBY-4124:
-----------------------------------------

I think you're overreacting a bit. That site is just one of many describing the basic issue, but if you really have problems with using information from webpages (in which case I presume you must not be reading any webpages at all, lest you get tainted by information from them) then you can also go ahead and do a detailed reading of JLS which, if read correctly, will also explain why double-checked locking is broken.

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4124) Broken double-checked-locking in EmbeddedDataSource.findDriver

Posted by "Myrna van Lunteren (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12690147#action_12690147 ] 

Myrna van Lunteren commented on DERBY-4124:
-------------------------------------------

I didn't look at the actual fix - just saw a document with lots of names on it and references to articles etc. If it's not going to get us into trouble it's fine with me to fix this bug, of course.

> Broken double-checked-locking in EmbeddedDataSource.findDriver
> --------------------------------------------------------------
>
>                 Key: DERBY-4124
>                 URL: https://issues.apache.org/jira/browse/DERBY-4124
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.4.2.0
>         Environment: all
>            Reporter: Ronald Tschalaer
>
> org.apache.derby.jdbc.EmbeddedDataSource.findDriver() uses the
> double-checked-locking idiom for setting the 'driver' variable. This
> idiom is, however, not correct and hence the code is broken. The fix
> is to remove the outer if, i.e. to always enter the synchronized block.
> See also
> http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.