Client Deadlock : Closing session in finally block when connection exception 
occurs.
------------------------------------------------------------------------------------

                 Key: QPID-849
                 URL: https://issues.apache.org/jira/browse/QPID-849
             Project: Qpid
          Issue Type: Bug
            Reporter: Martin Ritchie


Summary
See the two threads bellow this can be reliably repeated running 
org.apache.qpid.test.unit.basic.SelectorTest and changing the selector string 
to the invalid 'Cost LIKE 2'. This will cause the connection to be created but 
the consumer creation will cause a connection close exception which starts the 
session closing. The thrown exception will itself then cause the connection to 
be close. The trace below shows the deadlock case where the IOService blocks on 
the main close() which is in turn waiting for the CloseOK return that the 
IOService thread will deliver. 


Stack Traces:
Full thread dump Java HotSpot(TM) Client VM (1.6.0_02-b06 mixed mode):
"AnonymousIoService-2" daemon prio=6 tid=0x0b29f800 nid=0x1584 waiting for 
monitor entry [0x0b7ff000..0x0b7ffc94]
   java.lang.Thread.State: BLOCKED (on object monitor)
        at org.apache.qpid.client.AMQSession.closed(AMQSession.java:653)
        - waiting to lock <0x02fc6ef8> (a java.lang.Object)
        at 
org.apache.qpid.client.AMQConnection.closeAllSessions(AMQConnection.java:1025)
        at 
org.apache.qpid.client.AMQConnection.exceptionReceived(AMQConnection.java:1300)
        at 
org.apache.qpid.client.protocol.AMQProtocolHandler.exceptionCaught(AMQProtocolHandler.java:377)
        at 
org.apache.qpid.client.protocol.AMQProtocolHandler.methodBodyReceived(AMQProtocolHandler.java:505)
        at 
org.apache.qpid.client.protocol.AMQProtocolSession.methodFrameReceived(AMQProtocolSession.java:537)
        at 
org.apache.qpid.framing.AMQMethodBodyImpl.handle(AMQMethodBodyImpl.java:93)
        at 
org.apache.qpid.client.protocol.AMQProtocolHandler.messageReceived(AMQProtocolHandler.java:442)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:703)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
        at 
org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:60)
        at 
org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:184)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:362)
        at 
org.apache.mina.common.support.AbstractIoFilterChain.access$1200(AbstractIoFilterChain.java:54)
        at 
org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:800)
        at 
org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:243)
        at 
org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:305)
        at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)
        at 
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:619)



"main" prio=6 tid=0x00297c00 nid=0x874 waiting on condition 
[0x0090f000..0x0090fe54]
   java.lang.Thread.State: WAITING (parking)
        at sun.misc.Unsafe.park(Native Method)
        - parking to wait for  <0x02a2d2b0> (a 
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
        at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
        at 
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
        at 
org.apache.qpid.client.protocol.BlockingMethodFrameListener.blockForFrame(BlockingMethodFrameListener.java:196)
        at 
org.apache.qpid.client.protocol.AMQProtocolHandler.writeCommandFrameAndWaitForReply(AMQProtocolHandler.java:598)
        at 
org.apache.qpid.client.protocol.AMQProtocolHandler.syncWrite(AMQProtocolHandler.java:625)
        at org.apache.qpid.client.AMQSession.close(AMQSession.java:617)
        - locked <0x02a72560> (a java.lang.Object)
        - locked <0x02fc6ef8> (a java.lang.Object)
        at org.apache.qpid.client.AMQSession.close(AMQSession.java:482)
        at 
org.apache.qpid.test.unit.basic.SelectorTest.test(SelectorTest.java:118)
        - locked <0x02eb2ca0> (a org.apache.qpid.test.unit.basic.SelectorTest)
        at 
org.apache.qpid.test.unit.basic.SelectorTest.main(SelectorTest.java:150)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)



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

Reply via email to