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

Conflicting select then update with REPEATABLE_READ gives lock timeout instead of deadlock

    Details

    • Urgency:
      Normal
    • Issue & fix info:
      High Value Fix

      Description

      The attached program TryTimeout.java should detect a deadlock but instead throws a lock timeout exception. The program has two threads that attempt:

      threadConnection.setAutoCommit(false);
      /* set isolation level to repeatable read */
      threadConnection.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);

      ResultSet rs = stmt.executeQuery("select * from t where i = 456");
      while (rs.next());
      stmt.executeUpdate("update t set i = 456 where i = 456");
      threadConnection.commit();

      This gives SQLState 40001 (deadlock) with DB2 but a lock timeout with Derby.

        Attachments

        1. TryTimeout2.out.10_1.locktimeout
          17 kB
          Kathey Marsden
        2. TryTimeout2.out.10_1.locktimeout
          19 kB
          Kathey Marsden
        3. TryTimeout2.out.10_1.deadlock
          5 kB
          Kathey Marsden
        4. TryTimeout2.out.10_1.deadlock
          7 kB
          Kathey Marsden
        5. TryTimeout2.java
          9 kB
          Kathey Marsden
        6. TryTimeout.java
          4 kB
          Kathey Marsden
        7. LockTimeoutWithInserts.java
          8 kB
          Kathey Marsden
        8. LiveLockTest_with_Deadlock_look_diff.txt
          2 kB
          Kathey Marsden
        9. LiveLockTest_diff.txt
          8 kB
          Kathey Marsden
        10. javacore.20081209.092827.9800.txt
          177 kB
          Kathey Marsden
        11. derby-3980-1a.diff
          17 kB
          Knut Anders Hatlen
        12. derby-3980_javadoc_and_test_diff.txt
          8 kB
          Kathey Marsden
        13. derby.log.10_1
          19 kB
          Kathey Marsden
        14. derby.log
          19 kB
          Kathey Marsden

          Issue Links

            Activity

              People

              • Assignee:
                knutanders Knut Anders Hatlen
                Reporter:
                kmarsden Kathey Marsden
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: