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

        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: