You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Craig Day <cr...@jdv.com> on 2006/04/28 06:53:44 UTC

Client: XXX already connected bug

While using the new Spring-2.0 DefaultMessageListenerContainer I can
reliably reproduce the following exception on the broker side which
usually results in a hang on the client side:
 
The broker logs the following exception:
 
INFO  Service                        - Sync error occurred:
javax.jms.InvalidClientIDException: Broker: localhost - Client:
ID:inspiron-1410-114619274
7453-2:1 already connected
javax.jms.InvalidClientIDException: Broker: localhost - Client:
ID:inspiron-1410-1146192747453-2:1 already connected
        at
org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroke
r.java:154)
        at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
65)
        at
org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker
.java:69)
        at
org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
65)
        at
org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrok
erFilter.java:77)
        at
org.apache.activemq.broker.AbstractConnection.processAddConnection(Abstr
actConnection.java:500)
        at
org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConn
ection(ManagedTransportConnection.java:82)
        at
org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:106
)
        at
org.apache.activemq.broker.AbstractConnection.service(AbstractConnection
.java:196)
        at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConn
ection.java:62)
        at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorre
lator.java:93)
        at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.
java:70)
        at
org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatN
egotiator.java:114)
        at
org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMoni
tor.java:122)
        at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSuppor
t.java:87)
        at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:139
)
        at java.lang.Thread.run(Thread.java:595)
 
I have extrapolated the sequence of calls that
DefaultMessageListenerContainer is making and managed to produce a
simple test case that reproduces the problem:
 
import junit.framework.TestCase;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;
 
import javax.jms.*;
 
public class TestActiveMQ extends TestCase {
 
    public void testConnectionFactory() throws Exception {
        final ActiveMQConnectionFactory cf = new
ActiveMQConnectionFactory("tcp://localhost:61616");
        final ActiveMQQueue queue = new ActiveMQQueue("testqueue");
        final Connection conn = cf.createConnection();
 
        Runnable r = new Runnable() {
            public void run() {
                try {
                    Session session = conn.createSession(false, 1);
                    MessageConsumer consumer =
session.createConsumer(queue, null);
                    Message msg = consumer.receive(1000);
                } catch (JMSException e) {
                    e.printStackTrace();
                }
            }
        };
        new Thread(r).start();
        conn.start();
 
        try {
            synchronized (this) {
                wait(3000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
 
Let us know if you need anymore information. Dont want to scrub ActiveMQ
from my list of candidates If I can help it.
 
cheers
craig
 


------------------------------------------------------------------------------------------------------------------------------
This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination, forwarding, printing, copying or dealing in any way whatsoever with this e-mail is strictly prohibited. If you have received this e-mail in error, please reply to us immediately and delete the document.
It is the recipient's duty to virus-scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. JDV Limited does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference.
JDV Limited, and each of its related companies each reserve the right to monitor all e-mail communications through its networks. 
Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of JDV Limited.
Your private information is only used and disclosed for the intention which you have provided it for. This information is not disclosed or used unless your consent has been provided or in the case that JDV Limited is permitted to do so under the Privacy Act of 1988.
-----------------------------------------------------------------------------------------------------------------------------

Re: Client: XXX already connected bug

Posted by srodrigues <sr...@wilshire.com>.
Not sure if this is still an issue, I was facing the same "already connected"
problem even with 4.0 and 4.0.1 and I just switched from
DefaultMessageListenerContainer to SimpleMessageListenerContainer and it
worked fine with no such exception. 

I could get this to work by replacing the DefaultMessageListenerFactory with
the SimpleMessageListenerFactory class and there were no more hung servers. 

Side Note: I have had six listener containers and each one listens to a
different Queue. This configuration works if I assign concurrentConsumers in
each of these listener containers equal to 1. ( 6 x 1 = 6. )

If I assign concurrentConsumers in each of these listener containers to 2.
(6 x 2 = 12 ) When I do this  two listener consumers do not receive the
message, implying there is a some limit on the total number of
concurrentConsumers in such a configuration. 


-- 
View this message in context: http://www.nabble.com/Client%3A-XXX-already-connected-bug-tf1522491.html#a5223575
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Client: XXX already connected bug

Posted by James Strachan <ja...@gmail.com>.
Thanks for the extra comments you added to the JIRA issue...

https://issues.apache.org/activemq/browse/AMQ-696

I think this issue is now fixed in SVN HEAD and tomorrows snapshot builds.


On 5/1/06, James Strachan <ja...@gmail.com> wrote:
> I've tried this test case against SVN HEAD and it works perfectly for me.
>
> The strack trace you got is only ever created when a broker receives a
> start connection with a clientID which is already connected to the
> broker (as it is against the JMS spec to allow 2 clients with the same
> ID to be connected at once).
>
> The test case you supply only creates one connection and does not
> specify a clientID (so we auto-generate a unique one for each
> connection). So I doubt its possible for this test case to fail - I
> suspect its something else really causing your problem with Spring.
>
> e.g. is your spring code trying to create 2 connections with the same
> client ID? Does the spring code specify a clientID (via
> Connection.setClientID())?
>
> On 4/28/06, Craig Day <cr...@jdv.com> wrote:
> > While using the new Spring-2.0 DefaultMessageListenerContainer I can
> > reliably reproduce the following exception on the broker side which
> > usually results in a hang on the client side:
> >
> > The broker logs the following exception:
> >
> > INFO  Service                        - Sync error occurred:
> > javax.jms.InvalidClientIDException: Broker: localhost - Client:
> > ID:inspiron-1410-114619274
> > 7453-2:1 already connected
> > javax.jms.InvalidClientIDException: Broker: localhost - Client:
> > ID:inspiron-1410-1146192747453-2:1 already connected
> >         at
> > org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroke
> > r.java:154)
> >         at
> > org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
> > 65)
> >         at
> > org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker
> > .java:69)
> >         at
> > org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
> > 65)
> >         at
> > org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrok
> > erFilter.java:77)
> >         at
> > org.apache.activemq.broker.AbstractConnection.processAddConnection(Abstr
> > actConnection.java:500)
> >         at
> > org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConn
> > ection(ManagedTransportConnection.java:82)
> >         at
> > org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:106
> > )
> >         at
> > org.apache.activemq.broker.AbstractConnection.service(AbstractConnection
> > .java:196)
> >         at
> > org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConn
> > ection.java:62)
> >         at
> > org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorre
> > lator.java:93)
> >         at
> > org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.
> > java:70)
> >         at
> > org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatN
> > egotiator.java:114)
> >         at
> > org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMoni
> > tor.java:122)
> >         at
> > org.apache.activemq.transport.TransportSupport.doConsume(TransportSuppor
> > t.java:87)
> >         at
> > org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:139
> > )
> >         at java.lang.Thread.run(Thread.java:595)
> >
> > I have extrapolated the sequence of calls that
> > DefaultMessageListenerContainer is making and managed to produce a
> > simple test case that reproduces the problem:
> >
> > import junit.framework.TestCase;
> > import org.apache.activemq.ActiveMQConnectionFactory;
> > import org.apache.activemq.command.ActiveMQQueue;
> >
> > import javax.jms.*;
> >
> > public class TestActiveMQ extends TestCase {
> >
> >     public void testConnectionFactory() throws Exception {
> >         final ActiveMQConnectionFactory cf = new
> > ActiveMQConnectionFactory("tcp://localhost:61616");
> >         final ActiveMQQueue queue = new ActiveMQQueue("testqueue");
> >         final Connection conn = cf.createConnection();
> >
> >         Runnable r = new Runnable() {
> >             public void run() {
> >                 try {
> >                     Session session = conn.createSession(false, 1);
> >                     MessageConsumer consumer =
> > session.createConsumer(queue, null);
> >                     Message msg = consumer.receive(1000);
> >                 } catch (JMSException e) {
> >                     e.printStackTrace();
> >                 }
> >             }
> >         };
> >         new Thread(r).start();
> >         conn.start();
> >
> >         try {
> >             synchronized (this) {
> >                 wait(3000);
> >             }
> >         } catch (InterruptedException e) {
> >             e.printStackTrace();
> >         }
> >     }
> > }
> >
> > Let us know if you need anymore information. Dont want to scrub ActiveMQ
> > from my list of candidates If I can help it.
> >
> > cheers
> > craig
> >
> >
> >
> > ------------------------------------------------------------------------------------------------------------------------------
> > This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination, forwarding, printing, copying or dealing in any way whatsoever with this e-mail is strictly prohibited. If you have received this e-mail in error, please reply to us immediately and delete the document.
> > It is the recipient's duty to virus-scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. JDV Limited does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference.
> > JDV Limited, and each of its related companies each reserve the right to monitor all e-mail communications through its networks.
> > Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of JDV Limited.
> > Your private information is only used and disclosed for the intention which you have provided it for. This information is not disclosed or used unless your consent has been provided or in the case that JDV Limited is permitted to do so under the Privacy Act of 1988.
> > -----------------------------------------------------------------------------------------------------------------------------
> >
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>


--

James
-------
http://radio.weblogs.com/0112098/

Re: Client: XXX already connected bug

Posted by James Strachan <ja...@gmail.com>.
I've tried this test case against SVN HEAD and it works perfectly for me.

The strack trace you got is only ever created when a broker receives a
start connection with a clientID which is already connected to the
broker (as it is against the JMS spec to allow 2 clients with the same
ID to be connected at once).

The test case you supply only creates one connection and does not
specify a clientID (so we auto-generate a unique one for each
connection). So I doubt its possible for this test case to fail - I
suspect its something else really causing your problem with Spring.

e.g. is your spring code trying to create 2 connections with the same
client ID? Does the spring code specify a clientID (via
Connection.setClientID())?

On 4/28/06, Craig Day <cr...@jdv.com> wrote:
> While using the new Spring-2.0 DefaultMessageListenerContainer I can
> reliably reproduce the following exception on the broker side which
> usually results in a hang on the client side:
>
> The broker logs the following exception:
>
> INFO  Service                        - Sync error occurred:
> javax.jms.InvalidClientIDException: Broker: localhost - Client:
> ID:inspiron-1410-114619274
> 7453-2:1 already connected
> javax.jms.InvalidClientIDException: Broker: localhost - Client:
> ID:inspiron-1410-1146192747453-2:1 already connected
>         at
> org.apache.activemq.broker.region.RegionBroker.addConnection(RegionBroke
> r.java:154)
>         at
> org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
> 65)
>         at
> org.apache.activemq.advisory.AdvisoryBroker.addConnection(AdvisoryBroker
> .java:69)
>         at
> org.apache.activemq.broker.BrokerFilter.addConnection(BrokerFilter.java:
> 65)
>         at
> org.apache.activemq.broker.MutableBrokerFilter.addConnection(MutableBrok
> erFilter.java:77)
>         at
> org.apache.activemq.broker.AbstractConnection.processAddConnection(Abstr
> actConnection.java:500)
>         at
> org.apache.activemq.broker.jmx.ManagedTransportConnection.processAddConn
> ection(ManagedTransportConnection.java:82)
>         at
> org.apache.activemq.command.ConnectionInfo.visit(ConnectionInfo.java:106
> )
>         at
> org.apache.activemq.broker.AbstractConnection.service(AbstractConnection
> .java:196)
>         at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConn
> ection.java:62)
>         at
> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorre
> lator.java:93)
>         at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.
> java:70)
>         at
> org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatN
> egotiator.java:114)
>         at
> org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMoni
> tor.java:122)
>         at
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSuppor
> t.java:87)
>         at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:139
> )
>         at java.lang.Thread.run(Thread.java:595)
>
> I have extrapolated the sequence of calls that
> DefaultMessageListenerContainer is making and managed to produce a
> simple test case that reproduces the problem:
>
> import junit.framework.TestCase;
> import org.apache.activemq.ActiveMQConnectionFactory;
> import org.apache.activemq.command.ActiveMQQueue;
>
> import javax.jms.*;
>
> public class TestActiveMQ extends TestCase {
>
>     public void testConnectionFactory() throws Exception {
>         final ActiveMQConnectionFactory cf = new
> ActiveMQConnectionFactory("tcp://localhost:61616");
>         final ActiveMQQueue queue = new ActiveMQQueue("testqueue");
>         final Connection conn = cf.createConnection();
>
>         Runnable r = new Runnable() {
>             public void run() {
>                 try {
>                     Session session = conn.createSession(false, 1);
>                     MessageConsumer consumer =
> session.createConsumer(queue, null);
>                     Message msg = consumer.receive(1000);
>                 } catch (JMSException e) {
>                     e.printStackTrace();
>                 }
>             }
>         };
>         new Thread(r).start();
>         conn.start();
>
>         try {
>             synchronized (this) {
>                 wait(3000);
>             }
>         } catch (InterruptedException e) {
>             e.printStackTrace();
>         }
>     }
> }
>
> Let us know if you need anymore information. Dont want to scrub ActiveMQ
> from my list of candidates If I can help it.
>
> cheers
> craig
>
>
>
> ------------------------------------------------------------------------------------------------------------------------------
> This e-mail and any files transmitted with it are confidential and are only for the use of the person to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use, dissemination, forwarding, printing, copying or dealing in any way whatsoever with this e-mail is strictly prohibited. If you have received this e-mail in error, please reply to us immediately and delete the document.
> It is the recipient's duty to virus-scan and otherwise test the enclosed information before using the information or loading attached files onto any computer system. JDV Limited does not warrant that the information contained in this e-mail is free from viruses, defects, errors, interception or interference.
> JDV Limited, and each of its related companies each reserve the right to monitor all e-mail communications through its networks.
> Any views expressed in this message are those of the individual sender, except where that sender specifically states them to be the views of JDV Limited.
> Your private information is only used and disclosed for the intention which you have provided it for. This information is not disclosed or used unless your consent has been provided or in the case that JDV Limited is permitted to do so under the Privacy Act of 1988.
> -----------------------------------------------------------------------------------------------------------------------------
>
>


--

James
-------
http://radio.weblogs.com/0112098/