db-derby-dev mailing list archives

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

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

Knut Anders Hatlen commented on DERBY-3980:

Just a guess here, since I haven't checked the details. In the inner
for loop of Deadlock.look(), there's some code to prevent false
positives for self-deadlocks:

    // We could be seeing a situation here like
    // Granted T1{S}, T2{S}
    // Waiting T1{X} - deadlock checking on this
    // In this case it's not a deadlock, although it
    // depends on the locking policy of the Lockable. E.g.
    if (lock.canSkip) {
        // not a deadlock ...
        chain.push(space); // set up as rollback() expects.

        continue outer;

I'm wondering if this perhaps is too broad. Both the transactions that
are waiting for the X lock already have a shared lock on the row, so
they'll both have lock.canSkip==true. We may be giving up finding a
deadlock along that path too early.

> 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:,,,,
>            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.

View raw message