db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kathey Marsden (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3980) Conflicting select then update with REPEATABLE_READ gives lock timeout instead of deadlock
Date Wed, 10 Dec 2008 14:14:44 GMT

    [ https://issues.apache.org/jira/browse/DERBY-3980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12655216#action_12655216
] 

Kathey Marsden commented on DERBY-3980:
---------------------------------------

I pursued some of Mike's debugging steps.
    o verify if a deadlock search is being made or not?
        The code enters Deadlock.look() so if that means it is doing a deadlock search then
we are.
    o run in sane mode and turn on the SanityManager.DEBUG_ON("DeadlockTrace") flag.
       I set this but don't see any output difference.  In my calling program I just called
   SanityManager.DEBUG_ON("DeadlockTrace").
       Am I doing something wrong?
    o If a deadlock search is being made, use the sanity code to dump out the lock table when
the deadlock search is done and
       misses the deadlock.
      Haven't tried this yet.
    o see if the bug still happens if there is only 1 row in the table. 
     It still happens with one row.
    o see if it still happens with a delete
     The same problem exists with delete.
   o verify two threads are waiting on lock with <ctrl> break.
      Here are the two traces with the program set to do a delete instead of update.
4XESTACKTRACE          at java/lang/Object.wait(Native Method)
4XESTACKTRACE          at java/lang/Object.wait(Object.java:231)
4XESTACKTRACE          at org/apache/derby/impl/services/daemon/BasicDaemon.rest(BasicDaemon.java:571)
4XESTACKTRACE          at org/apache/derby/impl/services/daemon/BasicDaemon.run(BasicDaemon.java:388)
4XESTACKTRACE          at java/lang/Thread.run(Thread.java:803)
3XMTHREADINFO      "Thread-5" (TID:0x4203EC00, sys_thread_t:0x42286868, state:CW, native ID:0x00001D94)
prio=5
4XESTACKTRACE          at java/lang/Object.wait(Native Method)
4XESTACKTRACE          at java/lang/Object.wait(Object.java:231)
4XESTACKTRACE          at org/apache/derby/impl/services/locks/ActiveLock.waitForGrant(ActiveLock.java:118)
4XESTACKTRACE          at org/apache/derby/impl/services/locks/ConcurrentLockSet.lockObject(ConcurrentLockSet.java:463(Compiled
Code))
4XESTACKTRACE          at org/apache/derby/impl/services/locks/AbstractPool.lockObject(AbstractPool.java:119)
4XESTACKTRACE          at org/apache/derby/impl/services/locks/ConcurrentPool.lockObject(ConcurrentPool.java:28)
4XESTACKTRACE          at org/apache/derby/impl/store/raw/xact/RowLocking3.lockRecordForRead(RowLocking3.java:187)
4XESTACKTRACE          at org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.lockPositionForRead(OpenConglomerate.java:436)
4XESTACKTRACE          at org/apache/derby/impl/store/access/conglomerate/GenericScanController.fetchRows(GenericScanController.java:683)
4XESTACKTRACE          at org/apache/derby/impl/store/access/heap/HeapScan.fetchNext(HeapScan.java:240)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/TableScanResultSet.getNextRowCore(TableScanResultSet.java:680)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/ProjectRestrictResultSet.getNextRowCore(ProjectRestrictResultSet.java:255)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/DMLWriteResultSet.getNextRowCore(DMLWriteResultSet.java:127)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/DeleteResultSet.setup(DeleteResultSet.java:252)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/DeleteResultSet.open(DeleteResultSet.java:136)
4XESTACKTRACE          at org/apache/derby/impl/sql/GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:416)
4XESTACKTRACE          at org/apache/derby/impl/sql/GenericPreparedStatement.execute(GenericPreparedStatement.java:297)
4XESTACKTRACE          at org/apache/derby/impl/jdbc/EmbedStatement.executeStatement(EmbedStatement.java:1235)
4XESTACKTRACE          at org/apache/derby/impl/jdbc/EmbedStatement.execute(EmbedStatement.java:625)
4XESTACKTRACE          at org/apache/derby/impl/jdbc/EmbedStatement.executeUpdate(EmbedStatement.java:175)
4XESTACKTRACE          at TryTimeout.threadWorker(TryTimeout.java:125)
4XESTACKTRACE          at TryTimeout.access$000(TryTimeout.java:5)
4XESTACKTRACE          at TryTimeout$1.run(TryTimeout.java:69)
4XESTACKTRACE          at java/lang/Thread.run(Thread.java:803)
3XMTHREADINFO      "Thread-6" (TID:0x4203F000, sys_thread_t:0x42286ABC, state:CW, native ID:0x00001C5C)
prio=5
4XESTACKTRACE          at java/lang/Object.wait(Native Method)
4XESTACKTRACE          at java/lang/Object.wait(Object.java:231)
4XESTACKTRACE          at org/apache/derby/impl/services/locks/ActiveLock.waitForGrant(ActiveLock.java:118)
4XESTACKTRACE          at org/apache/derby/impl/services/locks/ConcurrentLockSet.lockObject(ConcurrentLockSet.java:463(Compiled
Code))
4XESTACKTRACE          at org/apache/derby/impl/services/locks/AbstractPool.lockObject(AbstractPool.java:119)
4XESTACKTRACE          at org/apache/derby/impl/services/locks/ConcurrentPool.lockObject(ConcurrentPool.java:28)
4XESTACKTRACE          at org/apache/derby/impl/store/raw/xact/RowLocking3.lockRecordForWrite(RowLocking3.java:248)
4XESTACKTRACE          at org/apache/derby/impl/store/access/conglomerate/OpenConglomerate.lockPositionForWrite(OpenConglomerate.java:541)
4XESTACKTRACE          at org/apache/derby/impl/store/access/conglomerate/GenericConglomerateController.delete(GenericConglomerateController.java:179)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/RowChangerImpl.deleteRow(RowChangerImpl.java:478)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/DeleteResultSet.collectAffectedRows(DeleteResultSet.java:405)
4XESTACKTRACE          at org/apache/derby/impl/sql/execute/DeleteResultSet.open(DeleteResultSet.java:137)
4XESTACKTRACE          at org/apache/derby/impl/sql/GenericPreparedStatement.executeStmt(GenericPreparedStatement.java:416)
4XESTACKTRACE          at org/apache/derby/impl/sql/GenericPreparedStatement.execute(GenericPreparedStatement.java:297)
4XESTACKTRACE          at org/apache/derby/impl/jdbc/EmbedStatement.executeStatement(EmbedStatement.java:1235)
4XESTACKTRACE          at org/apache/derby/impl/jdbc/EmbedStatement.execute(EmbedStatement.java:625)
4XESTACKTRACE          at org/apache/derby/impl/jdbc/EmbedStatement.executeUpdate(EmbedStatement.java:175)
4XESTACKTRACE          at TryTimeout.threadWorker(TryTimeout.java:125)
4XESTACKTRACE          at TryTimeout.access$000(TryTimeout.java:5)
4XESTACKTRACE          at TryTimeout$1.run(TryTimeout.java:69)
4XESTACKTRACE          at java/lang/Thread.run(Thread.java:803)




> Conflicting select then update with REPEATABLE_READ gives lock timeout instead of deadlock
> ------------------------------------------------------------------------------------------
>
>                 Key: DERBY-3980
>                 URL: https://issues.apache.org/jira/browse/DERBY-3980
>             Project: Derby
>          Issue Type: Bug
>          Components: Store
>    Affects Versions: 10.1.3.1, 10.2.2.0, 10.3.3.0, 10.4.2.0, 10.5.0.0
>            Reporter: Kathey Marsden
>         Attachments: derby.log, derby.log.10_1, javacore.20081209.092827.9800.txt, TryTimeout.java
>
>
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message