[ 
https://issues.apache.org/jira/browse/DERBY-5552?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kathey Marsden updated DERBY-5552:
----------------------------------

    Attachment: ReproDerby5552LockTimeout.java

The attached reproduction ReproDerby5552LockTimeout.java shows the loss of 
connection with a lock timeout and resulting protocol error.   It doesn't show 
the hang, but as I understand it that might be a separate synchronization issue.
$ java ReproDerby5552LockTimeout
Wed Jan 04 15:34:10 PST 2012 : Apache Derby Network Server - 10.9.0.0 alpha - 
(1227344) started and ready to accept conn
ections on port 1597
Expected Exception java.sql.SQLTransactionRollbackException: DERBY SQL error: 
SQLCODE: -1, SQLSTATE: 40XL1, SQLERRMC: 40
XL1
Connection ok. got right value
Exception in thread "main" java.sql.SQLNonTransientConnectionException: A 
network protocol error was encountered and the
 connection has been terminated: the requested command encountered an 
unarchitected and implementation-specific conditio
n for which there was no architected message (additional information may be 
available in the derby.log file on the serve
r)
        at 
org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(SQLExceptionFactory40.java:71)
        at 
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:364)
        at 
org.apache.derby.client.am.Connection.createStatement(Connection.java:379)
        at 
org.apache.derby.client.am.LogicalConnection.createStatement(LogicalConnection.java:164)
        at 
ReproDerby5552LockTimeout.checkConn(ReproDerby5552LockTimeout.java:85)
        at ReproDerby5552LockTimeout.main(ReproDerby5552LockTimeout.java:66)
Caused by: org.apache.derby.client.am.SqlException: A network protocol error 
was encountered and the connection has been
 terminated: the requested command encountered an unarchitected and 
implementation-specific condition for which there wa
s no architected message (additional information may be available in the 
derby.log file on the server)
        at 
org.apache.derby.client.am.SqlException.copyAsUnchainedSQLException(SqlException.java:511)
        at 
org.apache.derby.client.am.Sqlca.chainDeferredExceptionsToAgentOrAsConnectionWarnings(Sqlca.java:346)
        at org.apache.derby.client.am.Sqlca.getJDBCMessage(Sqlca.java:308)
        at 
org.apache.derby.client.am.SqlException.getMessage(SqlException.java:408)
        at 
org.apache.derby.client.am.SqlException.getSQLException(SqlException.java:364)
        at org.apache.derby.client.am.Statement.executeQuery(Statement.java:486)
        at ReproDerby5552LockTimeout.main(ReproDerby5552LockTimeout.java:57)



                
> 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

        

Reply via email to