How do you shut down ActiveMQ transport?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How do you shut down ActiveMQ transport?

Bjorn Danielsson
Hi guys,

I just noticed that TomEE-plus takes a very long time
to shutdown if a remote ActiveMQ broker is being used.
Has anyone else seen this behaviour? Or could I be doing
something strange that causes this?

When running "shutdown.sh" Tomcat stops all webapps as
usual, but it takes somewhere between 10-30 minutes before
the JVM terminates. During that time two TCP connections
to the remote broker are kept open.

The same application using a "tcp://localhost:61616" broker
hosted within TomEE shuts down immediately as expected.

Version info:

apache-tomee-1.1.0-20120531.144231-5-plus
apache-activemq-5.6.0 (on the remote host, using default conf)

--
Björn Danielsson
Cuspy Code AB
Reply | Threaded
Open this post in threaded view
|

Re: How do you shut down ActiveMQ transport?

Romain Manni-Bucau
Hi,

Dont have it in head but i think AMQ has some url options to shutdown
quickly

Maybe try to add daemon option to true

- Romain
Le 31 mai 2012 18:55, "Bjorn Danielsson" <[hidden email]>
a écrit :

> Hi guys,
>
> I just noticed that TomEE-plus takes a very long time
> to shutdown if a remote ActiveMQ broker is being used.
> Has anyone else seen this behaviour? Or could I be doing
> something strange that causes this?
>
> When running "shutdown.sh" Tomcat stops all webapps as
> usual, but it takes somewhere between 10-30 minutes before
> the JVM terminates. During that time two TCP connections
> to the remote broker are kept open.
>
> The same application using a "tcp://localhost:61616" broker
> hosted within TomEE shuts down immediately as expected.
>
> Version info:
>
> apache-tomee-1.1.0-20120531.144231-5-plus
> apache-activemq-5.6.0 (on the remote host, using default conf)
>
> --
> Björn Danielsson
> Cuspy Code AB
>
Reply | Threaded
Open this post in threaded view
|

RE: How do you shut down ActiveMQ transport?

Filip Hanik (mailing lists)
Tomcat has a force shutdown option. Make sure you set CATALINA_PID variable
to point to a file name, for example in

setenv.sh put

CATALINA_PID=$CATALINA_BASE/logs/tomcat.pid

Then, call './shutdown.sh -force'

This will use unix kill and kill -9 as opposed to trying to connect into the
JVM.
Tomcat first issues a regular 'kill' and then gives the JVM some time to
exit, if the jvm doesn't exit, it terminates the process.
This is the preferred way to shutdown, since a OutofMemoryError in your
application may leave the JVM hanging.



Filip

> -----Original Message-----
> From: Romain Manni-Bucau [mailto:[hidden email]]
> Sent: Thursday, May 31, 2012 11:31 AM
> To: [hidden email]
> Subject: Re: How do you shut down ActiveMQ transport?
>
> Hi,
>
> Dont have it in head but i think AMQ has some url options to shutdown
> quickly
>
> Maybe try to add daemon option to true
>
> - Romain
> Le 31 mai 2012 18:55, "Bjorn Danielsson" <bjorn-
> [hidden email]>
> a écrit :
>
> > Hi guys,
> >
> > I just noticed that TomEE-plus takes a very long time
> > to shutdown if a remote ActiveMQ broker is being used.
> > Has anyone else seen this behaviour? Or could I be doing
> > something strange that causes this?
> >
> > When running "shutdown.sh" Tomcat stops all webapps as
> > usual, but it takes somewhere between 10-30 minutes before
> > the JVM terminates. During that time two TCP connections
> > to the remote broker are kept open.
> >
> > The same application using a "tcp://localhost:61616" broker
> > hosted within TomEE shuts down immediately as expected.
> >
> > Version info:
> >
> > apache-tomee-1.1.0-20120531.144231-5-plus
> > apache-activemq-5.6.0 (on the remote host, using default conf)
> >
> > --
> > Björn Danielsson
> > Cuspy Code AB
> >

Reply | Threaded
Open this post in threaded view
|

Re: How do you shut down ActiveMQ transport?

AndyG
In reply to this post by Bjorn Danielsson
Can you provide your broker configuration/url.

You probably just need to add 'useShutdownHook=true'.

Andy.
Reply | Threaded
Open this post in threaded view
|

Re: How do you shut down ActiveMQ transport?

Bjorn Danielsson
In reply to this post by Filip Hanik (mailing lists)
Thanks for the info on -force, that is certainly useful
in many situations. I wish I had known that years ago!

--
Björn Danielsson
Cuspy Code AB


"Filip Hanik (mailing lists)" <[hidden email]> wrote:

> Tomcat has a force shutdown option. Make sure you set CATALINA_PID variable
> to point to a file name, for example in
>
> setenv.sh put
>
> CATALINA_PID=$CATALINA_BASE/logs/tomcat.pid
>
> Then, call './shutdown.sh -force'
>
> This will use unix kill and kill -9 as opposed to trying to connect into the
> JVM.
> Tomcat first issues a regular 'kill' and then gives the JVM some time to
> exit, if the jvm doesn't exit, it terminates the process.
> This is the preferred way to shutdown, since a OutofMemoryError in your
> application may leave the JVM hanging.
>
>
>
> Filip
>
>> -----Original Message-----
>> From: Romain Manni-Bucau [mailto:[hidden email]]
>> Sent: Thursday, May 31, 2012 11:31 AM
>> To: [hidden email]
>> Subject: Re: How do you shut down ActiveMQ transport?
>>
>> Hi,
>>
>> Dont have it in head but i think AMQ has some url options to shutdown
>> quickly
>>
>> Maybe try to add daemon option to true
>>
>> - Romain
>> Le 31 mai 2012 18:55, "Bjorn Danielsson" <bjorn-
>> [hidden email]>
>> a écrit :
>>
>> > Hi guys,
>> >
>> > I just noticed that TomEE-plus takes a very long time
>> > to shutdown if a remote ActiveMQ broker is being used.
>> > Has anyone else seen this behaviour? Or could I be doing
>> > something strange that causes this?
>> >
>> > When running "shutdown.sh" Tomcat stops all webapps as
>> > usual, but it takes somewhere between 10-30 minutes before
>> > the JVM terminates. During that time two TCP connections
>> > to the remote broker are kept open.
>> >
>> > The same application using a "tcp://localhost:61616" broker
>> > hosted within TomEE shuts down immediately as expected.
>> >
>> > Version info:
>> >
>> > apache-tomee-1.1.0-20120531.144231-5-plus
>> > apache-activemq-5.6.0 (on the remote host, using default conf)
>> >
>> > --
>> > Björn Danielsson
>> > Cuspy Code AB
>> >
Reply | Threaded
Open this post in threaded view
|

Re: How do you shut down ActiveMQ transport?

Bjorn Danielsson
In reply to this post by AndyG
I use an empty BrokerXmlConfig in TomEE+ (which is only a JMS client
with a couple of MDBs in this scenario) and then this url:

  ServerUrl tcp://remote.host.name:61616

The remote host uses a standalone ActiveMQ default configuration,
fresh out of the box. I think useShutdownHook only applies on the
server end.

After some more suspicions and testing I found that using NIO on
the client works better:

  ServerUrl nio://remote.host.name:61616

This allows the transport thread to shut down immediately.

--
Björn Danielsson
Cuspy Code AB


AndyG <[hidden email]> wrote:
> Can you provide your broker configuration/url.
>
> You probably just need to add 'useShutdownHook=true'.
>
> Andy.
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/How-do-you-shut-down-ActiveMQ-transport-tp4655255p4655295.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.