You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by drjava <na...@zippersnapper.com> on 2008/06/13 23:30:01 UTC

Getting BindException on client side after restart of broker

I am (still) in the process of testing a JmsMessenger class called
JmsLogMessenger. One of my test cases scenario is as follows:

* start the JMS broker (Active Mq 5.1.0, embedded)
* start a thread that sends messages at a given interval.
* after a while (n seconds) shut the broker down
* after another m seconds re-start the broker (during shutdown the messages
are saved to a temporary store)
* wait for some more n seconds (during which the sending thread keeps on
sending and the JmsMessenger recovers the messages from the temp store. 
* stop the sending thread.
* wait a little bit - give the receiver a chance to intercept all the
messages
* compare number of messages sent to number of messages received.


If I send messages at a low rate - everything is fine and the test passes.
When I bump up the rate to 1 message per millisecond (but in reality it is
slower) - about 1000 messages never arrive at the receiving end. 
And I get BindException on the client (consumer) side.

Where did I go wrong?

I attach a text file with the exception stack trace, the spring xml config
file and the junit test file.

Thanks.

Environment Details:

IDE - eclipse 3.3.2
Spring - 2.5
test runner - Junit 4.4
ActiveMQ version - 5.1.0
VM - Java 1.6_0_06
OS - Windows XP 64bits
hardware - Dell, Intel core 2 quad cpu, 2.66GH, 3.93 GB of RAM 


http://www.nabble.com/file/p17832323/spring-config.xml spring-config.xml 
http://www.nabble.com/file/p17832323/JmsLogMessengerTest.java
JmsLogMessengerTest.java 
http://www.nabble.com/file/p17832323/BindException.rtf BindException.rtf 
-- 
View this message in context: http://www.nabble.com/Getting-BindException-on-client-side-after-restart-of-broker-tp17832323p17832323.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Getting BindException on client side after restart of broker

Posted by Dave Stanley <ds...@gmail.com>.
It may be taking a while for the broker.stop() to complete. If you try and
restart the broker before the transport connector from the previous broker
instance has been fully shutdown, that might explain the bind exception (as
the socket is already in use).

HTH
/Dave

On Tue, Jun 17, 2008 at 1:23 PM, drjava <na...@zippersnapper.com> wrote:

>
> the meaning of a BindException is clear to me.
>
> What baffles me is that the consumers were able to receive messages after
> the broker was restarted, and then all of a sudden I get this
> BindException.
> So WHO (or should I say "WHAT") could have taken those ports from the
> broker?
>
> Moreover this, from the output to the console, it seems as though the
> refreshConnectionUntilSuccessful method of the
> DefaultMessageListenerContainer eventually manages to establish a
> connection
> because I get BindException print outs and then some successfully received
> messages print outs and then exceptions again.
>
> But no matter how long I wait for all messages to be consumed - when a
> BindException is thrown, not all messages arrive. (Again, mind you that
> when
> I lower the rate of messages sent (either by making the sending Thread
> slower or allowing it to send messages for a shorter period of time) the
> test runs smoothly without any bind exceptions.)
>
>
>
>
> bsnyder wrote:
> >
> > On Sat, Jun 14, 2008 at 3:18 PM, drjava <na...@zippersnapper.com>
> wrote:
> >>
> >> I'm sorry...Trying again.
> >> http://www.nabble.com/file/p17843946/spring-config.xmlspring-config.xml
> >> http://www.nabble.com/file/p17843946/BindException.txtBindException.txt
> >> http://www.nabble.com/file/p17843946/JmsLogMessengerTest.java
> >> JmsLogMessengerTest.java
> >
> > Well the exception is telling you that an address to which ActiveMQ is
> > trying to bind is already in use:
> >
> > javax.jms.JMSException: Could not connect to broker URL:
> > tcp://localhost:61616. Reason:
> > java.net.BindException: Address already in use:
> >
> > Use netstat -an to see all addresses in use to see if either port 1099
> > or 61616 is already in use on your machine.
> >
> > Bruce
> > --
> > perl -e 'print
> > unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> > );'
> >
> > Apache ActiveMQ - http://activemq.org/
> > Apache Camel - http://activemq.org/camel/
> > Apache ServiceMix - http://servicemix.org/
> >
> > Blog: http://bruceblog.org/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Getting-BindException-on-client-side-after-restart-of-broker-tp17832323p17923733.html
>  Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Re: Getting BindException on client side after restart of broker

Posted by drjava <na...@zippersnapper.com>.
the meaning of a BindException is clear to me.

What baffles me is that the consumers were able to receive messages after
the broker was restarted, and then all of a sudden I get this BindException.
So WHO (or should I say "WHAT") could have taken those ports from the
broker? 

Moreover this, from the output to the console, it seems as though the
refreshConnectionUntilSuccessful method of the
DefaultMessageListenerContainer eventually manages to establish a connection
because I get BindException print outs and then some successfully received
messages print outs and then exceptions again. 

But no matter how long I wait for all messages to be consumed - when a
BindException is thrown, not all messages arrive. (Again, mind you that when
I lower the rate of messages sent (either by making the sending Thread
slower or allowing it to send messages for a shorter period of time) the
test runs smoothly without any bind exceptions.)




bsnyder wrote:
> 
> On Sat, Jun 14, 2008 at 3:18 PM, drjava <na...@zippersnapper.com> wrote:
>>
>> I'm sorry...Trying again.
>> http://www.nabble.com/file/p17843946/spring-config.xml spring-config.xml
>> http://www.nabble.com/file/p17843946/BindException.txt BindException.txt
>> http://www.nabble.com/file/p17843946/JmsLogMessengerTest.java
>> JmsLogMessengerTest.java
> 
> Well the exception is telling you that an address to which ActiveMQ is
> trying to bind is already in use:
> 
> javax.jms.JMSException: Could not connect to broker URL:
> tcp://localhost:61616. Reason:
> java.net.BindException: Address already in use:
> 
> Use netstat -an to see all addresses in use to see if either port 1099
> or 61616 is already in use on your machine.
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache ActiveMQ - http://activemq.org/
> Apache Camel - http://activemq.org/camel/
> Apache ServiceMix - http://servicemix.org/
> 
> Blog: http://bruceblog.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/Getting-BindException-on-client-side-after-restart-of-broker-tp17832323p17923733.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Getting BindException on client side after restart of broker

Posted by Bruce Snyder <br...@gmail.com>.
On Sat, Jun 14, 2008 at 3:18 PM, drjava <na...@zippersnapper.com> wrote:
>
> I'm sorry...Trying again.
> http://www.nabble.com/file/p17843946/spring-config.xml spring-config.xml
> http://www.nabble.com/file/p17843946/BindException.txt BindException.txt
> http://www.nabble.com/file/p17843946/JmsLogMessengerTest.java
> JmsLogMessengerTest.java

Well the exception is telling you that an address to which ActiveMQ is
trying to bind is already in use:

javax.jms.JMSException: Could not connect to broker URL:
tcp://localhost:61616. Reason:
java.net.BindException: Address already in use:

Use netstat -an to see all addresses in use to see if either port 1099
or 61616 is already in use on your machine.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/

Blog: http://bruceblog.org/

Re: Getting BindException on client side after restart of broker

Posted by drjava <na...@zippersnapper.com>.
I'm sorry...Trying again.
http://www.nabble.com/file/p17843946/spring-config.xml spring-config.xml 
http://www.nabble.com/file/p17843946/BindException.txt BindException.txt 
http://www.nabble.com/file/p17843946/JmsLogMessengerTest.java
JmsLogMessengerTest.java 

rajdavies wrote:
> 
> I couldn't actually read the attached file - can you attach again  
> without  the formatting ?
> 
> On 13 Jun 2008, at 22:30, drjava wrote:
> 
>>
>> I am (still) in the process of testing a JmsMessenger class called
>> JmsLogMessenger. One of my test cases scenario is as follows:
>>
>> * start the JMS broker (Active Mq 5.1.0, embedded)
>> * start a thread that sends messages at a given interval.
>> * after a while (n seconds) shut the broker down
>> * after another m seconds re-start the broker (during shutdown the  
>> messages
>> are saved to a temporary store)
>> * wait for some more n seconds (during which the sending thread  
>> keeps on
>> sending and the JmsMessenger recovers the messages from the temp  
>> store.
>> * stop the sending thread.
>> * wait a little bit - give the receiver a chance to intercept all the
>> messages
>> * compare number of messages sent to number of messages received.
>>
>>
>> If I send messages at a low rate - everything is fine and the test  
>> passes.
>> When I bump up the rate to 1 message per millisecond (but in reality  
>> it is
>> slower) - about 1000 messages never arrive at the receiving end.
>> And I get BindException on the client (consumer) side.
>>
>> Where did I go wrong?
>>
>> I attach a text file with the exception stack trace, the spring xml  
>> config
>> file and the junit test file.
>>
>> Thanks.
>>
>> Environment Details:
>>
>> IDE - eclipse 3.3.2
>> Spring - 2.5
>> test runner - Junit 4.4
>> ActiveMQ version - 5.1.0
>> VM - Java 1.6_0_06
>> OS - Windows XP 64bits
>> hardware - Dell, Intel core 2 quad cpu, 2.66GH, 3.93 GB of RAM
>>
>>
>> http://www.nabble.com/file/p17832323/spring-config.xml spring- 
>> config.xml
>> http://www.nabble.com/file/p17832323/JmsLogMessengerTest.java
>> JmsLogMessengerTest.java
>> http://www.nabble.com/file/p17832323/BindException.rtf  
>> BindException.rtf
>> -- 
>> View this message in context:
>> http://www.nabble.com/Getting-BindException-on-client-side-after-restart-of-broker-tp17832323p17832323.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Getting-BindException-on-client-side-after-restart-of-broker-tp17832323p17843946.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Getting BindException on client side after restart of broker

Posted by Rob Davies <ra...@gmail.com>.
I couldn't actually read the attached file - can you attach again  
without  the formatting ?

On 13 Jun 2008, at 22:30, drjava wrote:

>
> I am (still) in the process of testing a JmsMessenger class called
> JmsLogMessenger. One of my test cases scenario is as follows:
>
> * start the JMS broker (Active Mq 5.1.0, embedded)
> * start a thread that sends messages at a given interval.
> * after a while (n seconds) shut the broker down
> * after another m seconds re-start the broker (during shutdown the  
> messages
> are saved to a temporary store)
> * wait for some more n seconds (during which the sending thread  
> keeps on
> sending and the JmsMessenger recovers the messages from the temp  
> store.
> * stop the sending thread.
> * wait a little bit - give the receiver a chance to intercept all the
> messages
> * compare number of messages sent to number of messages received.
>
>
> If I send messages at a low rate - everything is fine and the test  
> passes.
> When I bump up the rate to 1 message per millisecond (but in reality  
> it is
> slower) - about 1000 messages never arrive at the receiving end.
> And I get BindException on the client (consumer) side.
>
> Where did I go wrong?
>
> I attach a text file with the exception stack trace, the spring xml  
> config
> file and the junit test file.
>
> Thanks.
>
> Environment Details:
>
> IDE - eclipse 3.3.2
> Spring - 2.5
> test runner - Junit 4.4
> ActiveMQ version - 5.1.0
> VM - Java 1.6_0_06
> OS - Windows XP 64bits
> hardware - Dell, Intel core 2 quad cpu, 2.66GH, 3.93 GB of RAM
>
>
> http://www.nabble.com/file/p17832323/spring-config.xml spring- 
> config.xml
> http://www.nabble.com/file/p17832323/JmsLogMessengerTest.java
> JmsLogMessengerTest.java
> http://www.nabble.com/file/p17832323/BindException.rtf  
> BindException.rtf
> -- 
> View this message in context: http://www.nabble.com/Getting-BindException-on-client-side-after-restart-of-broker-tp17832323p17832323.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>