Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 23361 invoked from network); 29 Nov 2010 20:31:35 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Nov 2010 20:31:35 -0000 Received: (qmail 28292 invoked by uid 500); 29 Nov 2010 20:31:35 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 28261 invoked by uid 500); 29 Nov 2010 20:31:35 -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 28253 invoked by uid 99); 29 Nov 2010 20:31:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Nov 2010 20:31:35 +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.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Nov 2010 20:31:33 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id oATKVBgc020504 for ; Mon, 29 Nov 2010 20:31:11 GMT Message-ID: <8755559.9451291062671220.JavaMail.jira@thor> Date: Mon, 29 Nov 2010 15:31:11 -0500 (EST) From: "Timothy Bish (JIRA)" To: dev@activemq.apache.org Subject: [jira] Updated: (AMQNET-293) Consumer is not recovered after failover reconnect if connection had been lost in OnMessage (before SendACK) 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-293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Timothy Bish updated AMQNET-293: -------------------------------- Affects Version/s: 1.4.1 1.4.0 Fix Version/s: 1.5.0 Assignee: Timothy Bish (was: Jim Gomes) > Consumer is not recovered after failover reconnect if connection had been lost in OnMessage (before SendACK) > ------------------------------------------------------------------------------------------------------------ > > Key: AMQNET-293 > URL: https://issues.apache.org/jira/browse/AMQNET-293 > Project: ActiveMQ .Net > Issue Type: Bug > Components: NMS > Affects Versions: 1.4.0, 1.4.1 > Environment: Windows XP - however I believe it's not dependent on the operating system > Reporter: Jan Vogelgesang > Assignee: Timothy Bish > Fix For: 1.5.0 > > Attachments: MessageConsumerDirtyPatch.cs, UnitTestAndPatch.zip > > > To reproduce the error write the simple WinForm application in C# with listbox (or console app) > 1. Create the connection: failover:(tcp://localhost:61616?keepAlive=true) and start it. > 2. Create the session and the QueueConsumer for queue e.g. "TestQueue" (in default AutoAcknoledged mode) > 3. For queue consumer set the message listener e.g. OnMessage > 4. In OnMessage method do something like Sleep(5000) and then display the received textMessage (by Invoke add the messge to listbox). > 5. By means of localhost:8161/admin create the TestQueue and put to this queue about 20 persistent text messages. > 6. Run the application. You should get on the screen new line every 5 seconds. > 7. Restart the ActiveMQ broker (I'm using 5.3.0.5) > 8. After restarting the broker you stop receiving the messages. > 9. Restart broker again. And you will start getting the messages. > ---------- > The problem is in NMS. > Most likely when you restart ActiveMQ broker the client app will be in OnMessage method (just sleeping there for 5 seconds). When those 5 seconds is over then the NMS is trying to SendACK. And this method will not end until failover thread successfully reconnect.. For that time there is a lock on the unconsumedMessages.SynchRoot (see MessageConsumer.Dispatch method). And this fact is painful for another thread which is trying to do the unconsumedMessage.Clear() and needs the locked resource. (this thread is initated in Connection.OnTransportInterrupted() and it wants to call ClearMessagesInProgress on MessageConsumer). > The worst thing is that the MessageConsumer.ClearMessagesInProgress method cannot call (as waits for locked resource) TransportInterruptionProcessingComplete() which I guess registers consumers which have to be recovered when the connection is back. > So when the connection is back: > SendAck completes > Failover thread DoRecover but does not find our consumer. > Dispatch method unlocks the unconsumedMessages.SynchRoot > The working thread registers consumers to be recovered (absolutely too late!!!!) > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.