Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 20881 invoked from network); 9 Oct 2009 14:25:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Oct 2009 14:25:21 -0000 Received: (qmail 69956 invoked by uid 500); 9 Oct 2009 14:25:17 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 69911 invoked by uid 500); 9 Oct 2009 14:25:17 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 69774 invoked by uid 99); 9 Oct 2009 14:25:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2009 14:25:17 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Oct 2009 14:25:13 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id BF19D234C48C for ; Fri, 9 Oct 2009 07:24:52 -0700 (PDT) Message-ID: <511101196.1255098292779.JavaMail.jira@brutus> Date: Fri, 9 Oct 2009 07:24:52 -0700 (PDT) From: "Carl Allain (JIRA)" To: dev@activemq.apache.org Subject: [jira] Commented: (AMQ-2446) Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C) In-Reply-To: <454877932.1255045792991.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: ae95407df07c98740808b2ef9da0087c X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/activemq/browse/AMQ-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=54695#action_54695 ] Carl Allain commented on AMQ-2446: ---------------------------------- Hi. I D/L 5.3 RC4 from the link above. I took my application, added the activemq-all-5.3.0.jar jar in my classpath (before other jars) and I still have the same problem (client hangs). I can't vote for a 5.3 RC4 without this being fixed ;-). It is just normal that sometimes, the broker has to be stopped and clients should really not hang like that. In the mean time, I redesigned portions of my app to use receiveNoWait() + my own thread sleeping logic (more latency though on new messages added to an empty queue of course) instead of receive(timeout) and with that, event with the 5.2 version, I get some exceptions that I can use to recover lost connections, and still use the prefetchSize=0 option on my connection URL. Still, we have an integration component using Camel on top of ActiveMQ, and for that one, there is not much I can do. Thanks. > Client hangs on receive call with timeout value > 0 when activemq is shutdown (CTRL-C) > -------------------------------------------------------------------------------------- > > Key: AMQ-2446 > URL: https://issues.apache.org/activemq/browse/AMQ-2446 > Project: ActiveMQ > Issue Type: Bug > Affects Versions: 5.2.0 > Environment: Windows XP SP3, ActiveMQ 5.2, prefetchSize=0 (java.naming.provider.url = tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=0) > Reporter: Carl Allain > > Start ActiveMQ > create a message consumer and make a receive(30000) call for example. > stop ActiveMQ (CTRL-C) > There is an error reported on the console: > 2009-10-08 19:23:54,978 [ActiveMQ Transport: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.ActiveMQConnection - Async exception with no exception listener: java.io.EOFException > java.io.EOFException > at java.io.DataInputStream.readInt(DataInputStream.java:358) > at org.apache.activemq.openwire.OpenWireFormat.unmarshal(OpenWireFormat.java:269) > at org.apache.activemq.transport.tcp.TcpTransport.readCommand(TcpTransport.java:210) > at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:202) > at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:185) > at java.lang.Thread.run(Thread.java:595) > 2009-10-08 19:23:54,978 [ActiveMQ Connection Worker: tcp://localhost/127.0.0.1:61616] DEBUG org.apache.activemq.transport.tcp.TcpTransport - Stopping transport tcp://localhost/127.0.0.1:61616 > The thread making the receive call is waiting on a mutex that the ActiveMQ Connection Worker thread that reported that log has (I guess): > class MessageDispatchChannel > public MessageDispatch dequeue(long timeout) throws InterruptedException { > synchronized (mutex) { > // Wait until the consumer is ready to deliver messages. > while (timeout != 0 && !closed && (list.isEmpty() || !running)) { > if (timeout == -1) { > mutex.wait(); <----------------------------------------------------------- > } else { > mutex.wait(timeout); > break; > } > } > if (closed || !running || list.isEmpty()) { > return null; > } > return list.removeFirst(); > } > } > What is also strange to me is that my timeout of 30000 ms is silently converted to an infinite timeout if the preFetchSize == 0 by this code? Why? > class ActiveMQMessageConsumer > ... > MessageDispatch md; > if (info.getPrefetchSize() == 0) { > md = dequeue(-1); // We let the broker let us know when we > // timeout. > } else { > md = dequeue(timeout); > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.