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 "Brett Bergquist (Created) (JIRA)" <ji...@apache.org> on 2011/12/28 16:28:30 UTC
[jira] [Created] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Race conditions in LogicalConnection checking for a null physical connection
----------------------------------------------------------------------------
Key: DERBY-5561
URL: https://issues.apache.org/jira/browse/DERBY-5561
Project: Derby
Issue Type: Bug
Components: Network Client
Affects Versions: 10.8.2.2
Environment: Solaris 10
Glassfish V2.1.1
ClientXADataSource connection pool
Reporter: Brett Bergquist
There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
RE: [jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Bergquist, Brett" <BB...@canoga.com>.
There are two threads accessing the same connection but this is because of the connection pool. When you configure a connection pool in Glassfish you can configure error handling on the pool. One option that can be configured is to configure the connection pool such that any error on any connection in the pool causes all of the connections in the pool to be destroyed and recreated. The management of the pool is under control of the application server.
So how my application got into this state is that one connection experienced an error. This was NOT the connection that was committing the transaction. The connection error was detected by the pool management code of Glassfish and it was configured to destroy all connections. So this code, in a separate thread, went through the connection list and called closed each of the connections. The timing is right and the synchronization is wrong so between the time the LogicalConnection checks for a null physical connection and the time it uses the physical connection, it is now null.
Note that many of the methods are synchronized and some are not. They should all be synchronized as obviously there is a window of opportunity between checking for a null physical connection and using the physical connection. With the synchronization, the pool management code of Glassfish that is closing the connections would have blocked on trying to null out the physical connection while the real transaction finished (it has the lock) or it could be that the physical connection would be null'ed out and then the checkForNullPhysicalConnection would have detected this and thrown its own exception. Either scenario is correct and consistent but instead what happens is that checkForNullPhysicalConnection does not see a null physical connection and then by the time it uses that physical connection it becomes null and then a NPE is thrown.
-----Original Message-----
From: Kathey Marsden (Commented) (JIRA) [mailto:jira@apache.org]
Sent: Wednesday, December 28, 2011 12:59 PM
To: derby-dev@db.apache.org
Subject: [jira] [Commented] (DERBY-5561) Race conditions in LogicalConnection checking for a null physical connection
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176727#comment-13176727 ]
Kathey Marsden commented on DERBY-5561:
---------------------------------------
Do you have multiple threads accessing the same connection at the same time? If so is it intentional? Typically when that is being done it is not intentional as even if the various methods were synchronized the two threads would share transaction and other state that would be difficult to coordinate.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
Re: [jira] [Commented] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by Katherine Marsden <km...@sbcglobal.net>.
On 12/28/2011 10:52 AM, Bergquist, Brett wrote:
> I have to get in the habit of putting the responses and stuff in the Jira. I did not realize that your message was from updating the Jira and just hit Reply. I will be better in the future but I am still an egg :)
No worries. It is nice to have things in Jira, but email can be helpful
for in-lining comments. As long as the threads get linked from Jira, it
will all be there for the next generation. Thanks for your work on Derby!
Kathey
RE: [jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Bergquist, Brett" <BB...@canoga.com>.
I have to get in the habit of putting the responses and stuff in the Jira. I did not realize that your message was from updating the Jira and just hit Reply. I will be better in the future but I am still an egg :)
-----Original Message-----
From: Kathey Marsden (Commented) (JIRA) [mailto:jira@apache.org]
Sent: Wednesday, December 28, 2011 12:59 PM
To: derby-dev@db.apache.org
Subject: [jira] [Commented] (DERBY-5561) Race conditions in LogicalConnection checking for a null physical connection
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176727#comment-13176727 ]
Kathey Marsden commented on DERBY-5561:
---------------------------------------
Do you have multiple threads accessing the same connection at the same time? If so is it intentional? Typically when that is being done it is not intentional as even if the various methods were synchronized the two threads would share transaction and other state that would be difficult to coordinate.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Siddharth Srivastava (Assigned) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Siddharth Srivastava reassigned DERBY-5561:
-------------------------------------------
Assignee: Siddharth Srivastava
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Attachments: DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13267172#comment-13267172 ]
Kristian Waagan commented on DERBY-5561:
----------------------------------------
Great!
I committed DERBY-5561.patch to trunk with revision 1333305.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Labels: derby_triage10_9
> Attachments: DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459800#comment-13459800 ]
Mamta A. Satoor commented on DERBY-5561:
----------------------------------------
Backported to 10.6.2.3 with revision 1388139
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Mamta A. Satoor
> Fix For: 10.6.2.3, 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Kathey Marsden (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176753#comment-13176753 ]
Kathey Marsden commented on DERBY-5561:
---------------------------------------
Just realized Brett's explanation is not in the Jira. It can be found in this thread.
http://old.nabble.com/-jira---Created--%28DERBY-5561%29-Race-conditions-in-LogicalConnection-checking-for-a-null-physical-connection-to33046047.html#a33046825
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan updated DERBY-5561:
-----------------------------------
Backported to 10.7 with revision 1383996.
I'll let the nightly tests run through before merging this fix back to 10.5, although I don't expect any problems.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Kristian Waagan
> Labels: derby_triage10_9
> Fix For: 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Reopened] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan reopened DERBY-5561:
------------------------------------
Assignee: Kristian Waagan (was: Brett Bergquist)
Reopening for backports.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Kristian Waagan
> Labels: derby_triage10_9
> Fix For: 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13459094#comment-13459094 ]
Mamta A. Satoor commented on DERBY-5561:
----------------------------------------
Assigning to me for backporting to 10.5
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Mamta A. Satoor
> Fix For: 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan updated DERBY-5561:
-----------------------------------
Issue & fix info: High Value Fix (was: Patch Available,High Value Fix)
I committed patch 2a to trunk with revision 1334919.
I'll give it a week or so before I look at backporting this to 10.8.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Labels: derby_triage10_9
> Attachments: DERBY-5561.patch, derby-5561-2a-minor_cleanups.diff
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden updated DERBY-5561:
----------------------------------
Labels: (was: derby_backport_reject_10_5)
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Kristian Waagan
> Fix For: 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden updated DERBY-5561:
----------------------------------
Affects Version/s: 10.5.3.2
Likely applies to 10.5 as well so might be good to backport.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Brett Bergquist
> Labels: derby_triage10_9
> Fix For: 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Brett Bergquist (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Brett Bergquist updated DERBY-5561:
-----------------------------------
Attachment: DERBY-5561.patch
This patch changes all methods that call "checkForNullPhysicalConnection" to be synchronized. Some of the methods in LogicalConnection.java already were. This patch makes all calls consistent and eliminates the race condition.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Attachments: DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mamta A. Satoor reassigned DERBY-5561:
--------------------------------------
Assignee: Kristian Waagan (was: Mamta A. Satoor)
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Kristian Waagan
> Fix For: 10.6.2.3, 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Kathey Marsden (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176747#comment-13176747 ]
Kathey Marsden commented on DERBY-5561:
---------------------------------------
Makes sense. Thanks for the explanation.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan resolved DERBY-5561.
------------------------------------
Resolution: Fixed
Fix Version/s: 10.5.3.2
Resolving again. Added 10.5.3.2 to fix versions.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Kristian Waagan
> Fix For: 10.5.3.2, 10.6.2.3, 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Siddharth Srivastava (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13197604#comment-13197604 ]
Siddharth Srivastava commented on DERBY-5561:
---------------------------------------------
thanks Brett for the patch. I will be looking into adding test for this patch.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Attachments: DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13262497#comment-13262497 ]
Kristian Waagan commented on DERBY-5561:
----------------------------------------
Any updates on this issue?
To me the changes look safe and correct. Given that the Connection interface probably won't see much change, and that writing a test that reliably detects missing synchronization in future methods (i.e. by using reflection and running a test pattern for each method) may be non-trivial, I suggest we commit the patch right away unless Siddharth is planning to write a test for this shortly.
Siddhart, what's your opinion on this?
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Labels: derby_triage10_9
> Attachments: DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan updated DERBY-5561:
-----------------------------------
Fix Version/s: 10.7.1.4
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Kristian Waagan
> Labels: derby_triage10_9
> Fix For: 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mamta A. Satoor updated DERBY-5561:
-----------------------------------
Fix Version/s: 10.6.2.3
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Mamta A. Satoor
> Fix For: 10.6.2.3, 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Kathey Marsden (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176727#comment-13176727 ]
Kathey Marsden commented on DERBY-5561:
---------------------------------------
Do you have multiple threads accessing the same connection at the same time? If so is it intentional? Typically when that is being done it is not intentional as even if the various methods were synchronized the two threads would share transaction and other state that would be difficult to coordinate.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13460110#comment-13460110 ]
Mamta A. Satoor commented on DERBY-5561:
----------------------------------------
Backported to 10.5.3.2 with revision 1388285
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Mamta A. Satoor
> Fix For: 10.6.2.3, 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan resolved DERBY-5561.
------------------------------------
Resolution: Fixed
Fix Version/s: 10.9.1.1
10.8.2.3
Assignee: Brett Bergquist (was: Siddharth Srivastava)
Backported to 10.8 with revision 1344183.
Resolving issue.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Brett Bergquist
> Labels: derby_triage10_9
> Fix For: 10.8.2.3, 10.9.1.1
>
> Attachments: DERBY-5561.patch, derby-5561-2a-minor_cleanups.diff
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (DERBY-5561) Race conditions in
LogicalConnection checking for a null physical connection
Posted by "Siddharth Srivastava (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13263366#comment-13263366 ]
Siddharth Srivastava commented on DERBY-5561:
---------------------------------------------
The patch works fine for me as well. I do plan to write the test for it but I can continue with it only after next week since I have exams till then.I'll add the test case for it after that.
Until then I too recommend committing the patch.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Labels: derby_triage10_9
> Attachments: DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kathey Marsden (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kathey Marsden updated DERBY-5561:
----------------------------------
Issue & fix info: High Value Fix,Patch Available
Urgency: Urgent
Labels: derby_triage10_9 (was: )
Triage for 10.9. Urgent, High Value Fix. Thanks Brett for the patch and Siddharth for picking up the testing and driving it to commit.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Labels: derby_triage10_9
> Attachments: DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kristian Waagan updated DERBY-5561:
-----------------------------------
Attachment: derby-5561-2a-minor_cleanups.diff
Attaching patch 2a, which cleans up a few minor issues:
o converts docs to Javadoc
o remove stale doc
o correct/improve some comments
o makes physicalConnection_ package-private
o makes checkForNullPhysicalConnection final
Patch ready for review.
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Siddharth Srivastava
> Labels: derby_triage10_9
> Attachments: DERBY-5561.patch, derby-5561-2a-minor_cleanups.diff
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (DERBY-5561) Race conditions in LogicalConnection
checking for a null physical connection
Posted by "Mamta A. Satoor (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/DERBY-5561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mamta A. Satoor reassigned DERBY-5561:
--------------------------------------
Assignee: Mamta A. Satoor (was: Kristian Waagan)
> Race conditions in LogicalConnection checking for a null physical connection
> ----------------------------------------------------------------------------
>
> Key: DERBY-5561
> URL: https://issues.apache.org/jira/browse/DERBY-5561
> Project: Derby
> Issue Type: Bug
> Components: Network Client
> Affects Versions: 10.5.3.2, 10.8.2.2
> Environment: Solaris 10
> Glassfish V2.1.1
> ClientXADataSource connection pool
> Reporter: Brett Bergquist
> Assignee: Mamta A. Satoor
> Fix For: 10.7.1.4, 10.8.2.3, 10.9.1.1
>
> Attachments: derby-5561-2a-minor_cleanups.diff, DERBY-5561.patch
>
>
> There are race conditions with checkForNullPhysicalConnection calls in LogicalConnection. checkForNullPhysicalConnection is not synchronized and it checks for the member "phsyicalConnection" which can be cleared by "nullPhsyicalConnection" (which is synchronized) and "close" (which is synchronized) and "closeWithoutRecyclingToPool" (which is synchronized).
> This affects "nativeSQL", "getAutoCommit", "getTransactionIsolation", "getWarnings", "isReadOnly", "getCatalog", "getTypeMap", "createStatement", "prepareCall", "prepareStatement", "setHoldability", "getHoldability", "setSavePoint", "rollBack", "releaseSavePoint", "getSchema", "setSchema".
> All of these call "checkForNullPhysicalConnection" and then use the member "physicalConnection" after that call returns. Because these methods are not synchronized, between the time "checkForNullPhysicalConnectoin" returns and "physicalConnection" is used, the "physicalConnection" member could be set to null and then a NPE occurs.
> Probably all of these methods should be changed to synchronized.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira