Derby
  1. Derby
  2. DERBY-5561

Race conditions in LogicalConnection checking for a null physical connection

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.5.3.2, 10.8.2.2
    • Component/s: Network Client
    • Labels:
      None
    • Environment:
      Solaris 10
      Glassfish V2.1.1
      ClientXADataSource connection pool
    • Urgency:
      Urgent
    • Issue & fix info:
      High Value Fix
    • Bug behavior facts:
      Crash, Seen in production

      Description

      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.

      1. derby-5561-2a-minor_cleanups.diff
        4 kB
        Kristian Waagan
      2. DERBY-5561.patch
        7 kB
        Brett Bergquist

        Activity

        Brett Bergquist created issue -
        Brett Bergquist made changes -
        Field Original Value New Value
        Attachment DERBY-5561.patch [ 12509289 ]
        Siddharth Srivastava made changes -
        Assignee Siddharth Srivastava [ siddharthsrivastava ]
        Kathey Marsden made changes -
        Labels derby_triage10_9
        Urgency Urgent [ 10051 ]
        Issue & fix info High Value Fix,Patch Available [ 10422,10102 ]
        Kristian Waagan made changes -
        Attachment derby-5561-2a-minor_cleanups.diff [ 12525403 ]
        Kristian Waagan made changes -
        Issue & fix info Patch Available,High Value Fix [ 10102,10422 ] High Value Fix [ 10422 ]
        Kristian Waagan made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Assignee Siddharth Srivastava [ siddharthsrivastava ] Brett Bergquist [ bbergquist ]
        Fix Version/s 10.8.2.3 [ 12318540 ]
        Fix Version/s 10.9.1.1 [ 12321551 ]
        Resolution Fixed [ 1 ]
        Kathey Marsden made changes -
        Affects Version/s 10.5.3.2 [ 12315436 ]
        Kristian Waagan made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Assignee Brett Bergquist [ bbergquist ] Kristian Waagan [ kristwaa ]
        Kristian Waagan made changes -
        Fix Version/s 10.7.1.4 [ 12315902 ]
        Kathey Marsden made changes -
        Labels derby_triage10_9 derby_backport_reject_10_5
        Kathey Marsden made changes -
        Labels derby_backport_reject_10_5
        Mamta A. Satoor made changes -
        Assignee Kristian Waagan [ kristwaa ] Mamta A. Satoor [ mamtas ]
        Mamta A. Satoor made changes -
        Fix Version/s 10.6.2.3 [ 12315434 ]
        Mamta A. Satoor made changes -
        Assignee Mamta A. Satoor [ mamtas ] Kristian Waagan [ kristwaa ]
        Kristian Waagan made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Fix Version/s 10.5.3.2 [ 12315436 ]
        Resolution Fixed [ 1 ]
        Kathey Marsden made changes -
        Fix Version/s 10.8.3.0 [ 12323456 ]
        Fix Version/s 10.8.2.3 [ 12318540 ]
        Kathey Marsden made changes -
        Fix Version/s 10.9.2.0 [ 12323562 ]
        Fix Version/s 10.9.1.1 [ 12321551 ]
        Gavin made changes -
        Workflow jira [ 12647224 ] Default workflow, editable Closed status [ 12802085 ]
        Knut Anders Hatlen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Kristian Waagan
            Reporter:
            Brett Bergquist
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development