Hi, I found that Consumer.close method is sometimes locked infinitely. In this month, I found this situation 4 times in our system.
The situation is like following sequences. 1. ActiveMQConnection is disconnected by KeepAlive packet not recieved. 2. Call Consumer.close method before connection is closed completely. 3. The thread is locked at ResponseCorrelator.request method. (please see ThreadDump) I needs help to fix or avoid this situation in a hurry. So, I write a path to avoid such case. Could you please check effectiveness of this patch? -- Patch (append this method to org.apache.activemq.transport.ResponseCorrelator class) public void stop() throws Exception{ // Copy and Clear the request Map ArrayList requests = new ArrayList(requestMap.values()); requestMap.clear(); for (Iterator iter = requests.iterator(); iter.hasNext();) { try { FutureResponse fr = (FutureResponse) iter.next(); fr.set(new ExceptionResponse(new Exception("TransportAlreadyStopped"))); } catch (InterruptedIOException e) { Thread.currentThread().interrupt(); } } } -- ThreadDump: "main" prio=1 tid=0x08060510 nid=0x21bb in Object.wait() [0xbfffb000..0xbfffbe28] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:474) at edu.emory.mathcs.backport.java.util.concurrent.locks.CondVar.await(CondVar.java:75) - locked <0x89518fd8> (a edu.emory.mathcs.backport.java.util.concurrent.locks.CondVar) at edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:318) at org.apache.activemq.transport.FutureResponse.getResult(FutureResponse.java:38) at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:74) at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1112) at org.apache.activemq.ActiveMQSession.syncSendPacket(ActiveMQSession.java:1667) at org.apache.activemq.ActiveMQMessageConsumer.close(ActiveMQMessageConsumer.java:516) at TestClass._recv(TestClass.java:348) at TestClass.recv(TestClass.java:279) at TestClass.run(TestClass.java:603) at TestClass.main2(TestClass.java:90) at TestClass.main(TestClass.java:112) Regards, Susumu Moro -- View this message in context: http://www.nabble.com/ActiveMQ4.0.1%3A-Consumer.close-is-locked-infinitely-tf2640275.html#a7370327 Sent from the ActiveMQ - User mailing list archive at Nabble.com.