[
https://issues.apache.org/jira/browse/DERBY-5552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13180258#comment-13180258
]
Dag H. Wanvik commented on DERBY-5552:
--------------------------------------
Tried the repro, I had to replace "new utilXid" with XATestUtil.getXid calls,
then it worked. FYI, the timeout property is misspelt as
"derby.locks.locktimeout", I had to change it to "derby.locks.waitTimeout", not
that it matters, I just was suprprised I had to wait to long (default is 60s)
for the timeout to happen.
Interestingly, if I use EmbeddedXADataSource instead of client ditto, the
following call throws:
checkConn(conn2);
again, due to the error cleanup having nulled out
"applicationConnection", cf. in this stack trace the frame
EmbedStatement#getConnection which has this code:
java.sql.Connection appConn =
getEmbedConnection().getApplicationConnection();
if ((appConn != applicationConnection) || (appConn == null)) {
throw Util.noCurrentConnection();
---------------------------------------------------------------- repro output
Expected Exception java.sql.SQLTransactionRollbackException: A
lock could not be obtained within the time requested Connection
ok. got right value Exception in thread "main"
java.sql.SQLNonTransientConnectionException: No current connection.
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:77)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:142)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Util.java:158)
at org.apache.derby.impl.jdbc.Util.noCurrentConnection(Util.java:262)
at
org.apache.derby.impl.jdbc.EmbedStatement.getConnection(EmbedStatement.java:1039)
at
org.apache.derby.iapi.jdbc.BrokeredStatement.controlCheck(BrokeredStatement.java:525)
at
org.apache.derby.iapi.jdbc.BrokeredStatement.getResultSetHoldability(BrokeredStatement.java:469)
at
org.apache.derby.iapi.jdbc.BrokeredStatement.<init>(BrokeredStatement.java:63)
at
org.apache.derby.iapi.jdbc.BrokeredStatement40.<init>(BrokeredStatement40.java:37)
at
org.apache.derby.iapi.jdbc.BrokeredConnection40.newBrokeredStatement(BrokeredConnection40.java:260)
at
org.apache.derby.jdbc.XAStatementControl.<init>(XAStatementControl.java:64)
at
org.apache.derby.jdbc.EmbedXAConnection.wrapStatement(EmbedXAConnection.java:192)
at
org.apache.derby.iapi.jdbc.BrokeredConnection.createStatement(BrokeredConnection.java:100)
at derby5552repro.Derby5552Repro.checkConn(Derby5552Repro.java:96) at
derby5552repro.Derby5552Repro.main(Derby5552Repro.java:76) Caused by:
java.sql.SQLException: No current connection. at
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:42)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory40.java:122)
at
org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
... 14 more Java Result: 1 BUILD SUCCESSFUL (total time: 21 minutes 51
seconds)
> Derby threads hanging when using ClientXADataSource and a deadlock or lock
> timeout occurs
> -----------------------------------------------------------------------------------------
>
> Key: DERBY-5552
> URL: https://issues.apache.org/jira/browse/DERBY-5552
> Project: Derby
> Issue Type: Bug
> Components: Network Server
> Affects Versions: 10.8.1.2
> Environment: Solaris 10, Glassfish V2.1.1,
> Reporter: Brett Bergquist
> Priority: Blocker
> Attachments: DERBY-5552-p1.patch, DERBY-5552-p2.patch,
> ReproDerby5552LockTimeout.java, appserverstack.txt, client.tar.Z, derby.log,
> derbystackatshutdown.txt, execute.patch, transactionsleft.txt
>
>
> The issue arrives when multiple XA transactions are done in parallel and
> there is either a lock timeout or a lock deadlock detected. When this
> happens the connection is leaked in the Glassfish connection pool and the
> client thread hangs in
> "org.apache.derby.client.netReply.fill(Reply.java:172)".
> Shutting down the app server fails because the thread has a lock in
> "org.apache.derby.client.net.NetConnection40" and another task is calling
> "org.apache.derby.client.ClientPooledConnection.close(ClientPooledConnection.java:214)"
> which is waiting for the lock.
> Killing the appsever using "kill" and then attempting to shutdown Derby
> network server causes the Network Server to hang. One of the threads hangs
> waiting for a lock at
> "org.apache.derby.impl.drda.NeworkServerControlImpl.removeFromSessionTable(NetworkServerControlImpl.java:1525)"
> and the "main" thread has this locked at
> "org.apache.derby.impl.drda.NetworkServerControlImpl.executeWork(NetworkServerControlImpl.java:2242)"
> and it itself is waiting for a lock which belongs to a thread that is stuck
> at
> "org.apache.derby.impl.services.locks.ActiveLock.waitForGrant(ActiveLock.java:118)
> which is in the TIMED_WAITING state.
> Only by killing the Network Server using "kill" is possible at this point.
> There are transactions left even though all clients have been removed.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira