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

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

    XMLWordPrintableJSON

Details

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

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              kmarsden Katherine Marsden
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: