You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by StefanL <st...@yahoo.se> on 2008/04/23 13:20:12 UTC

AMQNET Nms cannot use multiple connections, gets InvalidClientIDException

I'm trying to upgrade our activemq-dotnet from September 2007 to current
revision.
I though get an error in our code which creates multiple connections to the
broker and I get the 
javax.jms.InvalidClientIDException: Client: <guid> already connected from
<ip:port>

I can easily reproduce the error with this simple test case:
    [Test]
    public void TwoConnections()
    {
        Apache.NMS.IConnectionFactory connectionFactory = new
Apache.NMS.ActiveMQ.ConnectionFactory(new Uri("tcp://localhost:61616"));
        Apache.NMS.IConnection connection1 =
connectionFactory.CreateConnection();
        connection1.Start();
        Apache.NMS.IConnection connection2 =
connectionFactory.CreateConnection();
        connection2.Start();
        [snipped away stop and dispose]
    }

I've drilled down the behavioural change to ActiveMQ.ConnectionFactory
constructors and
CreateConnectionInfo.
The thing is that in revision 589629 the connection factory was changed so
the member 
clientId got set by the ctor and then used for connections created. 
I think that it should be null so a new clientId is generated per new
connection..

Should I change my code in some way to conform with current nms code or is
this a bug
in nms?
Regards and TIA
 /Stefan

-- 
View this message in context: http://www.nabble.com/AMQNET-Nms-cannot-use-multiple-connections%2C-gets-InvalidClientIDException-tp16834192s2354p16834192.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: AMQNET Nms cannot use multiple connections, gets InvalidClientIDException

Posted by Jim Gomes <e....@gmail.com>.
Hi Stefan,

Thanks for testing those changes. I am glad they solved the problem.

As far as the unit tests go, many of them have been broken (i.e.,
failing) for a long time.  I have been meaning to go back and take a
look at them to find out where the problems are.  They have been
neglected for too long.  My goal is to have all of them passing and
well maintained such that all tests pass with every change and all
changes are accompanied with a unit test.  Would you be willing to
create a patch submission of your multiple connection unit test?  It
would be good to add that to the main unit test corpus.

Thanks!
-Jim



On 4/25/08, StefanL <st...@yahoo.se> wrote:
>
> Hi Jim,
> Your correction works brilliantly, thanks for quick resolution.
>
> Some additional questions.
>
> What is the test status in e.g. Apache.NMS.ActiveMQ.Test. Should they
> work..?
> I currently get 7 tc's in error, have tried both on 4.1 and 5.0 broker.
>
> Also when I end my application I get some exceptions
> java.lang.IllegalStateException : Cannot remove a consumer from a session
> that had not been registered: c85b6218-9544-48a7-ae8b-56a86f6dc85a:1
> Apache.NMS.ActiveMQ.Transport.ResponseCorrelator.Request
> Apache.NMS.ActiveMQ.Connection.SyncRequest
> Apache.NMS.ActiveMQ.Connection.DisposeOf
> Apache.NMS.ActiveMQ.Session.DisposeOf
> Apache.NMS.ActiveMQ.MessageConsumer.Close
> Apache.NMS.ActiveMQ.Connection.Close
>
> They are catched in MessageConsumer.Close but does these exception signal
> that
> I have some nasty bug somewhere..
>
> I could troubleshoot further but could you provide some status info on
> these.
> ///Stefan
>
>
> semog wrote:
> >
> > Stefan,
> >
> > I checked in a change that should fix this problem.  Looks like it was
> > an incomplete change.  Would you grab the latest and see if that fixes
> > your problem?
> >
> > Thanks!
> > -Jim
> >
> >
> >
> >
> > On 4/23/08, James Strachan <ja...@gmail.com> wrote:
> >> On 23/04/2008, StefanL <st...@yahoo.se> wrote:
> >> >
> >> >  I'm trying to upgrade our activemq-dotnet from September 2007 to
> >> current
> >> >  revision.
> >> >  I though get an error in our code which creates multiple connections
> >> to
> >> the
> >> >  broker and I get the
> >> >  javax.jms.InvalidClientIDException: Client: <guid> already connected
> >> from
> >> >  <ip:port>
> >> >
> >> >  I can easily reproduce the error with this simple test case:
> >> >     [Test]
> >> >     public void TwoConnections()
> >> >     {
> >> >         Apache.NMS.IConnectionFactory connectionFactory = new
> >> >  Apache.NMS.ActiveMQ.ConnectionFactory(new
> >> Uri("tcp://localhost:61616"));
> >> >         Apache.NMS.IConnection connection1 =
> >> >  connectionFactory.CreateConnection();
> >> >         connection1.Start();
> >> >         Apache.NMS.IConnection connection2 =
> >> >  connectionFactory.CreateConnection();
> >> >         connection2.Start();
> >> >         [snipped away stop and dispose]
> >> >     }
> >> >
> >> >  I've drilled down the behavioural change to ActiveMQ.ConnectionFactory
> >> >  constructors and
> >> >  CreateConnectionInfo.
> >> >  The thing is that in revision 589629 the connection factory was
> >> changed
> >> so
> >> >  the member
> >> >  clientId got set by the ctor and then used for connections created.
> >>
> >> That sounds like a bug! Being able to specify the clientID as a
> >> property on the connection factory is useful, but it should maybe be
> >> smart enough to only use it for the first connection it creates.
> >>
> >> BTW does this only happen if you set the clientID property on the
> >> connection factory?
> >>
> >> --
> >> James
> >> -------
> >> http://macstrac.blogspot.com/
> >>
> >> Open Source Integration
> >> http://open.iona.com
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/AMQNET-Nms-cannot-use-multiple-connections%2C-gets-InvalidClientIDException-tp16834192s2354p16892288.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: AMQNET Nms cannot use multiple connections, gets InvalidClientIDException

Posted by StefanL <st...@yahoo.se>.
Hi Jim,
Your correction works brilliantly, thanks for quick resolution.

Some additional questions.

What is the test status in e.g. Apache.NMS.ActiveMQ.Test. Should they
work..?
I currently get 7 tc's in error, have tried both on 4.1 and 5.0 broker.

Also when I end my application I get some exceptions 
java.lang.IllegalStateException : Cannot remove a consumer from a session
that had not been registered: c85b6218-9544-48a7-ae8b-56a86f6dc85a:1
Apache.NMS.ActiveMQ.Transport.ResponseCorrelator.Request
Apache.NMS.ActiveMQ.Connection.SyncRequest
Apache.NMS.ActiveMQ.Connection.DisposeOf
Apache.NMS.ActiveMQ.Session.DisposeOf
Apache.NMS.ActiveMQ.MessageConsumer.Close
Apache.NMS.ActiveMQ.Connection.Close

They are catched in MessageConsumer.Close but does these exception signal
that
I have some nasty bug somewhere..

I could troubleshoot further but could you provide some status info on
these.
///Stefan


semog wrote:
> 
> Stefan,
> 
> I checked in a change that should fix this problem.  Looks like it was
> an incomplete change.  Would you grab the latest and see if that fixes
> your problem?
> 
> Thanks!
> -Jim
> 
> 
> 
> 
> On 4/23/08, James Strachan <ja...@gmail.com> wrote:
>> On 23/04/2008, StefanL <st...@yahoo.se> wrote:
>> >
>> >  I'm trying to upgrade our activemq-dotnet from September 2007 to
>> current
>> >  revision.
>> >  I though get an error in our code which creates multiple connections
>> to
>> the
>> >  broker and I get the
>> >  javax.jms.InvalidClientIDException: Client: <guid> already connected
>> from
>> >  <ip:port>
>> >
>> >  I can easily reproduce the error with this simple test case:
>> >     [Test]
>> >     public void TwoConnections()
>> >     {
>> >         Apache.NMS.IConnectionFactory connectionFactory = new
>> >  Apache.NMS.ActiveMQ.ConnectionFactory(new
>> Uri("tcp://localhost:61616"));
>> >         Apache.NMS.IConnection connection1 =
>> >  connectionFactory.CreateConnection();
>> >         connection1.Start();
>> >         Apache.NMS.IConnection connection2 =
>> >  connectionFactory.CreateConnection();
>> >         connection2.Start();
>> >         [snipped away stop and dispose]
>> >     }
>> >
>> >  I've drilled down the behavioural change to ActiveMQ.ConnectionFactory
>> >  constructors and
>> >  CreateConnectionInfo.
>> >  The thing is that in revision 589629 the connection factory was
>> changed
>> so
>> >  the member
>> >  clientId got set by the ctor and then used for connections created.
>>
>> That sounds like a bug! Being able to specify the clientID as a
>> property on the connection factory is useful, but it should maybe be
>> smart enough to only use it for the first connection it creates.
>>
>> BTW does this only happen if you set the clientID property on the
>> connection factory?
>>
>> --
>> James
>> -------
>> http://macstrac.blogspot.com/
>>
>> Open Source Integration
>> http://open.iona.com
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/AMQNET-Nms-cannot-use-multiple-connections%2C-gets-InvalidClientIDException-tp16834192s2354p16892288.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: AMQNET Nms cannot use multiple connections, gets InvalidClientIDException

Posted by Jim Gomes <e....@gmail.com>.
Stefan,

I checked in a change that should fix this problem.  Looks like it was
an incomplete change.  Would you grab the latest and see if that fixes
your problem?

Thanks!
-Jim




On 4/23/08, James Strachan <ja...@gmail.com> wrote:
> On 23/04/2008, StefanL <st...@yahoo.se> wrote:
> >
> >  I'm trying to upgrade our activemq-dotnet from September 2007 to current
> >  revision.
> >  I though get an error in our code which creates multiple connections to
> the
> >  broker and I get the
> >  javax.jms.InvalidClientIDException: Client: <guid> already connected from
> >  <ip:port>
> >
> >  I can easily reproduce the error with this simple test case:
> >     [Test]
> >     public void TwoConnections()
> >     {
> >         Apache.NMS.IConnectionFactory connectionFactory = new
> >  Apache.NMS.ActiveMQ.ConnectionFactory(new Uri("tcp://localhost:61616"));
> >         Apache.NMS.IConnection connection1 =
> >  connectionFactory.CreateConnection();
> >         connection1.Start();
> >         Apache.NMS.IConnection connection2 =
> >  connectionFactory.CreateConnection();
> >         connection2.Start();
> >         [snipped away stop and dispose]
> >     }
> >
> >  I've drilled down the behavioural change to ActiveMQ.ConnectionFactory
> >  constructors and
> >  CreateConnectionInfo.
> >  The thing is that in revision 589629 the connection factory was changed
> so
> >  the member
> >  clientId got set by the ctor and then used for connections created.
>
> That sounds like a bug! Being able to specify the clientID as a
> property on the connection factory is useful, but it should maybe be
> smart enough to only use it for the first connection it creates.
>
> BTW does this only happen if you set the clientID property on the
> connection factory?
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://open.iona.com
>

Re: AMQNET Nms cannot use multiple connections, gets InvalidClientIDException

Posted by James Strachan <ja...@gmail.com>.
On 23/04/2008, StefanL <st...@yahoo.se> wrote:
>
>  I'm trying to upgrade our activemq-dotnet from September 2007 to current
>  revision.
>  I though get an error in our code which creates multiple connections to the
>  broker and I get the
>  javax.jms.InvalidClientIDException: Client: <guid> already connected from
>  <ip:port>
>
>  I can easily reproduce the error with this simple test case:
>     [Test]
>     public void TwoConnections()
>     {
>         Apache.NMS.IConnectionFactory connectionFactory = new
>  Apache.NMS.ActiveMQ.ConnectionFactory(new Uri("tcp://localhost:61616"));
>         Apache.NMS.IConnection connection1 =
>  connectionFactory.CreateConnection();
>         connection1.Start();
>         Apache.NMS.IConnection connection2 =
>  connectionFactory.CreateConnection();
>         connection2.Start();
>         [snipped away stop and dispose]
>     }
>
>  I've drilled down the behavioural change to ActiveMQ.ConnectionFactory
>  constructors and
>  CreateConnectionInfo.
>  The thing is that in revision 589629 the connection factory was changed so
>  the member
>  clientId got set by the ctor and then used for connections created.

That sounds like a bug! Being able to specify the clientID as a
property on the connection factory is useful, but it should maybe be
smart enough to only use it for the first connection it creates.

BTW does this only happen if you set the clientID property on the
connection factory?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com