Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5552

Derby threads hanging when using ClientXADataSource and a deadlock or lock timeout occurs

    Details

    • Urgency:
      Urgent
    • Issue & fix info:
      Patch Available, Repro attached
    • Bug behavior facts:
      Crash, Seen in production

      Description

      The issue arrives when multiple XA transactions are done in parallel and there is either a lock timeout or a lock deadlock detected. When this happens the connection is leaked in the Glassfish connection pool and the client thread hangs in "org.apache.derby.client.netReply.fill(Reply.java:172)".

      Shutting down the app server fails because the thread has a lock in "org.apache.derby.client.net.NetConnection40" and another task is calling "org.apache.derby.client.ClientPooledConnection.close(ClientPooledConnection.java:214)" which is waiting for the lock.

      Killing the appsever using "kill" and then attempting to shutdown Derby network server causes the Network Server to hang. One of the threads hangs waiting for a lock at "org.apache.derby.impl.drda.NeworkServerControlImpl.removeFromSessionTable(NetworkServerControlImpl.java:1525)" and the "main" thread has this locked at "org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(NetworkServerControlImpl.java:2242)" and it itself is waiting for a lock which belongs to a thread that is stuck at "org.apache.derby.impl.services.locks.ActiveLock.waitForGrant(ActiveLock.java:118) which is in the TIMED_WAITING state.

      Only by killing the Network Server using "kill" is possible at this point.

      There are transactions left even though all clients have been removed.

        Attachments

        1. derby.log
          320 kB
          Brett Bergquist
        2. client.tar.Z
          69 kB
          Brett Bergquist
        3. transactionsleft.txt
          4 kB
          Brett Bergquist
        4. appserverstack.txt
          63 kB
          Brett Bergquist
        5. derbystackatshutdown.txt
          29 kB
          Brett Bergquist
        6. execute.patch
          1 kB
          Brett Bergquist
        7. DERBY-5552-p1.patch
          2 kB
          Brett Bergquist
        8. DERBY-5552-p2.patch
          0.5 kB
          Brett Bergquist
        9. ReproDerby5552LockTimeout.java
          5 kB
          Kathey Marsden
        10. derby-5552_withtest_diff.txt
          5 kB
          Kathey Marsden
        11. derby-5552_withtest_diff.txt
          5 kB
          Kathey Marsden
        12. derby-5552_withexpanded_test_diff.txt
          9 kB
          Kathey Marsden
        13. utilXid.java
          2 kB
          Kathey Marsden
        14. ReproDerby5552DB2.java
          4 kB
          Kathey Marsden

          Issue Links

            Activity

              People

              • Assignee:
                brettw Brett Wooldridge
                Reporter:
                bbergquist Brett Bergquist
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: