From activemq-users-return-2570-apmail-geronimo-activemq-users-archive=geronimo.apache.org@geronimo.apache.org Wed Jul 05 13:31:00 2006 Return-Path: Delivered-To: apmail-geronimo-activemq-users-archive@www.apache.org Received: (qmail 10980 invoked from network); 5 Jul 2006 13:30:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Jul 2006 13:30:59 -0000 Received: (qmail 68774 invoked by uid 500); 5 Jul 2006 13:30:59 -0000 Delivered-To: apmail-geronimo-activemq-users-archive@geronimo.apache.org Received: (qmail 68749 invoked by uid 500); 5 Jul 2006 13:30:59 -0000 Mailing-List: contact activemq-users-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: activemq-users@geronimo.apache.org Delivered-To: mailing list activemq-users@geronimo.apache.org Received: (qmail 68740 invoked by uid 99); 5 Jul 2006 13:30:58 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 06:30:58 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of chirino@gmail.com designates 66.249.92.174 as permitted sender) Received: from [66.249.92.174] (HELO ug-out-1314.google.com) (66.249.92.174) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Jul 2006 06:30:57 -0700 Received: by ug-out-1314.google.com with SMTP id m3so2369886uge for ; Wed, 05 Jul 2006 06:30:36 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=HnD5Dtnt0eW+7hMM3u78xjB5p87LjUGpGQO70UL8xGhnua1FaTdouvB/5GEaij2RQMauGSKMCfmHAIERnK3LaYPv4G+qaoFFTnwcB00N7iIurwSytci4P+1KYrz0kKcT8PJWRY8AC8Ai9v9Mh7ERKS7ptceTxB8sUyCDXo5949s= Received: by 10.66.244.10 with SMTP id r10mr7804483ugh; Wed, 05 Jul 2006 06:30:35 -0700 (PDT) Received: by 10.66.243.7 with HTTP; Wed, 5 Jul 2006 06:30:35 -0700 (PDT) Message-ID: Date: Wed, 5 Jul 2006 09:30:35 -0400 From: "Hiram Chirino" Sender: chirino@gmail.com To: activemq-users@geronimo.apache.org Subject: Re: Master-slave client reconnection In-Reply-To: <36e91d9d0607050539j6606e79cmb8b728996d65c372@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6398_28899322.1152106235821" References: <36e91d9d0607030404k2657f705p65b6b0bc757eb460@mail.gmail.com> <36e91d9d0607030412y48c26591x1d8df2e1b02e8b7e@mail.gmail.com> <36e91d9d0607050539j6606e79cmb8b728996d65c372@mail.gmail.com> X-Google-Sender-Auth: 2db7b06f9eaef868 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_6398_28899322.1152106235821 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Dejan, Thanks for figuring that out. I've open an JIRA issue to trace the resolution of the problem. http://issues.apache.org/activemq/browse/AMQ-796 On 7/5/06, Dejan Bosanac wrote: > > Hi, > > after some experiments I found that this problem only exists if there are > no > other threads in the application. It seems like connection thread dies > before it manages to reconnect. By starting another thread in the > application, it succeeds to recover from master failure and reconnect to > the > slave broker. So I have a workaround for now, but it would be nice to make > this work even for simple (single-threaded) clients. > > Regards, > Dejan > > On 7/3/06, Dejan Bosanac wrote: > > > > Yes, > > > > here's the URL (with replaced server names) > > > > > > > failover://(tcp://master_host:61616,tcp://slave_host:61616)?randomize=false&maxReconnectAttempts=3 > > > > I've added maxReconnectAttempts parameter later, so it doesn't really > > makes any difference. > > > > If you need any additional details, please let me know. > > > > Thanks, > > Dejan > > > > > > On 7/3/06, James Strachan < james.strachan@gmail.com> wrote: > > > > > > From your mail I couldn't see the brokerUrl you were using to connect > > > using failover to the master and slave. Are you using something like > > > the following? > > > > > > failover:tcp://master:61616,tcp://slave:61616 > > > > > > > > > > > > On 7/3/06, Dejan Bosanac < dejan@nighttale.net> wrote: > > > > Hi, > > > > > > > > I'm evaluating ActiveMQ's master-slave configuration in order to > make > > > my > > > > system more robust. > > > > I have noted that when I'm using message listeners client does not > > > reconnect > > > > to slave broker properly (when master broker goes down). > > > > Here's the example code: > > > > > > > > Queue dest = sess.createQueue("test"); > > > > MessageConsumer consumer = sess.createConsumer(dest); > > > > > > > > consumer.setMessageListener(new ClientReceiver()); > > > > con.start(); > > > > > > > > When I stop my master broker, my client dies with the following log > > > excerpt: > > > > > > > > 2006-07-03 12:18:08,262 [7.199.103:61616] DEBUG > > > > FailoverTransport - Transport failed, starting up > > > reconnect > > > > task > > > > java.io.EOFException > > > > at java.io.DataInputStream.readInt (Unknown Source) > > > > at org.apache.activemq.openwire.OpenWireFormat.unmarshal( > > > > OpenWireFormat.java:274) > > > > at org.apache.activemq.transport.tcp.TcpTransport.run( > > > TcpTransport.java > > > > :142) > > > > at java.lang.Thread.run(Unknown Source) > > > > 2006-07-03 12:18:08,262 [ActiveMQ Task ] DEBUG > > > > FailoverTransport - Attempting connect to: > > > > tcp://master_host:61616 > > > > > > > > If I change the above example to consume messages directly, like > this > > > > > > > > Queue dest = sess.createQueue("test"); > > > > MessageConsumer consumer = sess.createConsumer(dest); > > > > > > > > con.start(); > > > > Message msg = consumer.receive(); > > > > > > > > everything seems to be working fine: > > > > > > > > 2006-07-03 12:33:56,335 [7.199.103:61616] DEBUG > > > > FailoverTransport - Transport failed, starting up > > > reconnect > > > > task > > > > java.io.EOFException > > > > at java.io.DataInputStream.readInt(Unknown Source) > > > > at org.apache.activemq.openwire.OpenWireFormat.unmarshal( > > > > OpenWireFormat.java:274) > > > > at org.apache.activemq.transport.tcp.TcpTransport.run ( > > > TcpTransport.java > > > > :142) > > > > at java.lang.Thread.run(Unknown Source) > > > > 2006-07-03 12:33:56,335 [ActiveMQ Task ] DEBUG > > > > FailoverTransport - Attempting connect to: > > > > tcp://master_host:61616 > > > > 2006-07-03 12:33:57,356 [ActiveMQ Task ] DEBUG > > > > FailoverTransport - Connect fail to: > > > tcp://master_host:61616, > > > > reason: java.net.ConnectException: Connection refused: connect > > > > 2006-07-03 12:33:57,356 [ActiveMQ Task ] DEBUG > > > > FailoverTransport - Attempting connect to: > > > > tcp://slave_host:61616 > > > > 2006-07-03 12:33:57,366 [ActiveMQ Task ] DEBUG > > > > WireFormatNegotiator - Sending: WireFormatInfo { > version=1, > > > > properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true, > > > > SizePrefixDisabled=false, StackTraceEnabled=true, > > > > MaxInactivityDuration=30000, CacheEnabled=true}, > > > magic=[A,c,t,i,v,e,M,Q]} > > > > 2006-07-03 12:33:57,366 [ 47.199.98:61616] DEBUG > > > > TcpTransport - TCP consumer thread starting > > > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG > > > > WireFormatNegotiator - Received WireFormat: WireFormatInfo > { > > > > > > > version=1, properties={StackTraceEnabled=true, > > > TightEncodingEnabled=true, > > > > TcpNoDelayEnabled=true, SizePrefixDisabled=false, > > > > MaxInactivityDuration=30000, CacheEnabled=true}, > > > magic=[A,c,t,i,v,e,M,Q]} > > > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG > > > > WireFormatNegotiator - tcp://slave_host/slave_ip:61616 > > > before > > > > negotiation: OpenWireFormat{version=1, cacheEnabled=false, > > > > stackTraceEnabled=false, tightEncodingEnabled=false, > > > > sizePrefixDisabled=false} > > > > 2006-07-03 12:33:57,386 [47.199.98:61616] DEBUG > > > > WireFormatNegotiator - tcp://slave_host/slave_ip:61616 > after > > > > negotiation: OpenWireFormat{version=1, cacheEnabled=true, > > > > stackTraceEnabled=true, tightEncodingEnabled=true, > > > sizePrefixDisabled=false} > > > > 2006-07-03 12:33:57,396 [ActiveMQ Task ] DEBUG > > > > FailoverTransport - Connection established > > > > 2006-07-03 12:33:57,396 [ 47.199.98:61616] DEBUG > > > > FailoverTransport - Waking up reconnect task > > > > 2006-07-03 12:33:57,396 [47.199.98:61616] DEBUG > > > > ResponseCorrelator - Received unexpected response for > > > command > > > > id: 1 > > > > 2006-07-03 12:33:57,406 [47.199.98:61616] DEBUG > > > > ResponseCorrelator - Received unexpected response for > > > command > > > > id: 4 > > > > 2006-07-03 12:33:57,547 [47.199.98:61616] DEBUG > > > > ResponseCorrelator - Received unexpected response for > > > command > > > > id: 2 > > > > > > > > Has anyone else had such experiences and do you know any > workarounds? > > > > > > > > Regards, > > > > Dejan > > > > > > > > > > > > > > > > > -- > > > > > > James > > > ------- > > > http://radio.weblogs.com/0112098/ > > > > > > > > > -- Regards, Hiram Blog: http://hiramchirino.com ------=_Part_6398_28899322.1152106235821--