Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7514B938A for ; Wed, 28 Dec 2011 19:10:55 +0000 (UTC) Received: (qmail 12310 invoked by uid 500); 28 Dec 2011 19:10:55 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 12263 invoked by uid 500); 28 Dec 2011 19:10:55 -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 12255 invoked by uid 99); 28 Dec 2011 19:10:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Dec 2011 19:10:55 +0000 X-ASF-Spam-Status: No, hits=-2001.3 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Dec 2011 19:10:52 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 99E5212DE72 for ; Wed, 28 Dec 2011 19:10:30 +0000 (UTC) Date: Wed, 28 Dec 2011 19:10:30 +0000 (UTC) From: "Timothy Bish (Commented) (JIRA)" To: dev@activemq.apache.org Message-ID: <672360337.49086.1325099430631.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <688284247.39308.1324565250901.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (AMQNET-366) Deadlock when TCP connection breaks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AMQNET-366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13176767#comment-13176767 ] Timothy Bish commented on AMQNET-366: ------------------------------------- A SNAPSHOT build of 1.5.3 is available here: http://people.apache.org/~tabish/nms-1.5.0/ You can try it out and report back if the issue is not resolved for you. > Deadlock when TCP connection breaks > ----------------------------------- > > Key: AMQNET-366 > URL: https://issues.apache.org/jira/browse/AMQNET-366 > Project: ActiveMQ .Net > Issue Type: Bug > Components: ActiveMQ > Affects Versions: 1.5.2 > Reporter: Mikael Finstad > Assignee: Timothy Bish > Fix For: 1.5.3, 1.6.0 > > Attachments: ActiveMQTestWithoutSpring.cs, ActiveMQTests.cs > > > When an ActiveMQ TCP connection gets broken (for instance when the ActiveMQ server goes down), the AsyncCallExceptionListener is used by helper classes like SingleConnectionFactory and SimpleMessageListenerContainer from springframework.net to reconnect when connection becomes available again. > From this thread, these classes will call Close() on the connection which in turn calls Shutdown on the ThreadPoolExecutor (from the final block in Connection.cs:Close()). > Inside Shutdown(), the execution hangs on this.executionComplete.WaitOne(), and there is a deadlock because the AsyncCallExceptionListener call never returns, and nobody else triggers the executionComplete event > Simple test case to reproduce the problem: > using System; > using System.Threading; > using Apache.NMS.ActiveMQ; > using NUnit.Framework; > using Spring.Messaging.Nms.Listener; > [TestFixture] > public class ActiveMQTests > { > [Test] > [Ignore] > public void TestConnection() > { > var connectionFactory = new ConnectionFactory("tcp://localhost:61616") {UserName = "qwe", Password = "asd"}; > var messageListenerContainer = new SimpleMessageListenerContainer > { > ConnectionFactory = connectionFactory, > DestinationName = "test.test.in" > }; > messageListenerContainer.Start(); > Thread.Sleep(TimeSpan.FromMinutes(10)); > } > } > Start debugging. Wait until it connects tothe ActiveMQ server, shutdown the ActiveMQ server, pause execution and look at the Threads. > Example call stack: > [In a sleep, wait, or join] > [External Code] > Apache.NMS.ActiveMQ.DLL!Apache.NMS.ActiveMQ.Threads.ThreadPoolExecutor.Shutdown() Line 121 + 0xe bytes > Apache.NMS.ActiveMQ.DLL!Apache.NMS.ActiveMQ.Connection.Close() Line 592 + 0xd bytes > Spring.Messaging.Nms.DLL!Spring.Messaging.Nms.Connections.ConnectionFactoryUtils.ReleaseConnection(Apache.NMS.IConnection connection, Apache.NMS.IConnectionFactory cf, bool started) Line 74 + 0x9 bytes > Spring.Messaging.Nms.DLL!Spring.Messaging.Nms.Listener.AbstractListenerContainer.RefreshSharedConnection() Line 432 > Spring.Messaging.Nms.DLL!Spring.Messaging.Nms.Listener.SimpleMessageListenerContainer.RefreshConnectionUntilSuccessful() Line 242 > Spring.Messaging.Nms.DLL!Spring.Messaging.Nms.Listener.SimpleMessageListenerContainer.OnException(System.Exception exception) Line 210 > Apache.NMS.ActiveMQ.DLL!Apache.NMS.ActiveMQ.Connection.AsyncCallExceptionListener(object error) Line 945 + 0x11 bytes > Apache.NMS.ActiveMQ.DLL!Apache.NMS.ActiveMQ.Threads.ThreadPoolExecutor.Future.Run() Line 63 + 0x14 bytes > Apache.NMS.ActiveMQ.DLL!Apache.NMS.ActiveMQ.Threads.ThreadPoolExecutor.QueueProcessor(object unused) Line 150 + 0xa bytes > [External Code] > Should it not be possible to Close the connection from the AsyncCallExceptionListener thread? > I've tried running executor.Shutdown() in Connection.Close (under finally block) in a new thread and recompiling the NMS.ActiveMQ DLL, Like so: > if(executor != null) > { > var thread = new Thread(delegate() > { > executor.Shutdown(); > }); > thread.Start(); > } > This seems to solve the problem, however I am not certain that this will not break anything else. > I am using Spring framework.net version 1.3.2 and apache.NMS version 1.5.0 -- 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