db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius Stroffek (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2220) Uncommitted transactions executed throught XAResource will held locks after the application terminates (or crashes during the transaction).
Date Wed, 21 Feb 2007 17:56:06 GMT

    [ https://issues.apache.org/jira/browse/DERBY-2220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474776
] 

Julius Stroffek commented on DERBY-2220:
----------------------------------------

I tried this simple test program to run against trunk to find out whether it is possible to
join a global transaction after a connection is closed from a different connection and recover
in this way. The following code stopped in endless wait on xaResource2.start(xid, XAResource.TMJOIN)
waiting for a transaction to be disassociated from the connection already closed.

            xaResource.start(xid, XAResource.TMNOFLAGS);           
            Statement statement = conn.createStatement();
            statement.execute(query);
            xaConnection.close();
            
            xaResource2.start(xid, XAResource.TMJOIN);
            xaResource2.end(xid, XAResource.TMSUCCESS);
            xaResource2.commit(xid, true);

            System.exit(0);
-------
Dan: I applied your comments except that in Embedded driver I do not used the TMFAIL flag
because handling a one more exception separately would make the code a bit worse readable.
I think there is no difference in this since the transaction is rollbacked on the following
line. It will be explained in a comment. The only difference is a case when the rollback fails,
but I am not sure what else we can do with a transaction which cannot be committed and fails
to rollback.

I am running test suites now and I will post a new patch tomorrow.


> Uncommitted transactions executed throught XAResource will held locks after the application
terminates (or crashes during the transaction).
> -------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2220
>                 URL: https://issues.apache.org/jira/browse/DERBY-2220
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.3.0.0
>         Environment: Solaris Nevada build 49, Sun's JDK1.6
>            Reporter: Julius Stroffek
>         Assigned To: Julius Stroffek
>         Attachments: d2220_beta.diff, d2220_beta2.diff, d2220_try1.diff, d2220_try1.stat,
XATranTest.java, xxx.sql
>
>
> Using this piece of code derby will not release a table lock of 'dummy' table.
>             String query = "insert into dummy (field1) values ('" + Integer.toString(value)
+ "')";
>             XAConnection xaConnection = createXAConnection("jdbc:derby://localhost:1527/TestDB",
"", "");
>             XAResource xaResource = xaConnection.getXAResource();
>             conn = xaConnection.getConnection();
>             
>             Xid xid = createXid(value);        
>             xaResource.setTransactionTimeout(10);
>             xaResource.start(xid, XAResource.TMNOFLAGS);
>             
>             Statement statement = conn.createStatement();
>             statement.execute(query);        
>             
>             // terminate the client application
>             // this will not release any locks
>             System.exit(0);

-- 
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