activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject [HEADS UP] - Graceful shutdown of AMQ and fixing some leaks when doing hot-deployment
Date Thu, 06 Sep 2012 12:47:38 GMT

Recently I have been diving into fixing some leaks in ActiveMQ. It
started with the activemq-pool component which caused a Camel JMS
client to become slower, due memory leaks not being released.

The activemq-pool has been fixed now, and runs flawless again.
On a side note Tim Bish is working on improving the activemq-pool to
be a better pool by leveraging more logic from commons-pool on the
connection side as well. Beforehand it was only the sessions that was

Anyway continuing with the Camel JMS client, we have reports, about
leaks in Tomcat, when you redeploy an application. So I have been
tracking those down, and got most of it fixed. Have some pending
commits for the JMS client.

However on embedded a full blow ActiveMQ broker in a web container as
Tomcat, and then supporting hot deployment, surfaced some issues with
some thread pools not being closed graceful. Instead the pools is
closed aggresively, and as some of them have idle threads timeout of
30 seconds, then those threads dont timeout before the application is
redeployed (assuming you re-deploy the app; to remedy this you would
have to stop the app, and wait for > 30 sec, and then deploy again).

As we have some good graceful shutdown code in Camel, I have ported
part of that to AMQ, in the ThreadPoolUtils class in the util package.
There is a number of shutdown methods, to use for graceful shutdown.
When a graceful shutdown of a thread pool is in the works, and if it
takes some times, then we now log every 5th second about the shutdown
in progress.

There is a number of tickets in JIRA about this recent work (all the
stuff above, etc.)

Claus Ibsen
Twitter: davsclaus, fusenews
Author of Camel in Action:

View raw message