Hi Rob, FWIW here is the ThreadExplorer class: http://pastebin.com/f1aa2a099
> Do you actually call stop() on the broker ? Yes. > Have you disabled the shutdownHook from the broker ? No, we just did it but nothing has changed. In the meantime we experimented further and we were able to shutdown one of the lingering threads -- "[ActiveMQ Scheduler]" -- by using this snippet to our code: Scheduler scheduler = Scheduler.getInstance(); scheduler.shutdown(); After doing this the other lingering thread -- "[Timer-0]" -- did not go away, but at least we discovered that this timer is JMX related: if we disable JMX connector the timer disappear. Unfortunately we really need JMX connector, so this is causing a bit of a problem... any clues anyone? Cheers, F. PS: ...http://issues.apache.org/activemq/browse/AMQ-1214 "threads not stopping causing memory leaks which can lead to OutOfMemoryError" ...sounds related to this. On Thu, Jan 14, 2010 at 12:59 AM, Rob Davies <rajdav...@gmail.com> wrote: > oops - sry Fred - read your first email too quick - could you post the > ThreadExplorer class too ? > > thanks, > > Rob > > On 13 Jan 2010, at 22:24, Fred Moore wrote: > > Hi Rob, >> >> If you could post your code - or sample of it - might help >>> identify why your main isn't shutting down >>> >> >> I actually did... can you access this pastebin here: >> http://pastebin.com/f2784245a ? >> >> Cheers, >> F. >> >> On Wed, Jan 13, 2010 at 7:52 PM, Rob Davies <rajdav...@gmail.com> wrote: >> >> Do you actually call stop() on the broker ? - Have you disabled the >>> shutdownHook from the broker ? >>> If you could post your code - or sample of it - might help identify why >>> your main isn't shutting down >>> >>> On 13 Jan 2010, at 17:50, Fred Moore wrote: >>> >>> Hi folks, >>> >>>> >>>> we have a 5.3.0 embedded broker that refuses to shutdown cleanly because >>>> of >>>> lingering threads. >>>> >>>> We reproduced this with a very very basic configuration: with just vm & >>>> jmx >>>> connectors, no producers and no consumers and and this extremely simple >>>> main() program: http://pastebin.com/f2784245a that: >>>> >>>> 1\ Starts up an embedded broker >>>> >>>> 2\ Waits for the user to press a key >>>> >>>> 3\ Stops the broker >>>> >>>> 4\ Monitors (polling every few seconds) the number of lingering threads >>>> >>>> What we experience is that after step 1\ (broker startup) this is the >>>> list >>>> of active threads... >>>> >>>> * [main] Group: main >>>> * [ActiveMQ Scheduler] (Daemon) Group: main >>>> * [ActiveMQ Data File Writer] (Daemon) Group: main >>>> * [Timer-0] (Daemon) Group: main >>>> * [JMX connector] (Daemon) Group: main >>>> >>>> ...but a long time (dozens of seconds) after step 3\ (broker shutdown) >>>> these >>>> threads are still active: >>>> >>>> * [main] Group: main >>>> * [ActiveMQ Scheduler] (Daemon) Group: main >>>> * [Timer-0] (Daemon) Group: main >>>> >>>> Questions: >>>> Q1\ Are we missing something obvious? >>>> Q2\ Is there a better way to shutdown an embedded broker? >>>> Q3\ Doing it the hard way via system.exit() is going to get us into >>>> worse >>>> troubles? (data corruption & co) >>>> >>>> Thanks in advance for your help. >>>> Cheers, >>>> F. >>>> >>>> >>>> >>>> >>>> The embedding was performed >>>> >>>> >>> Rob Davies >>> http://twitter.com/rajdavies >>> I work here: http://fusesource.com >>> My Blog: http://rajdavies.blogspot.com/ >>> I'm writing this: http://www.manning.com/snyder/ >>> >>> >>> >>> >>> >>> >>> > Rob Davies > http://twitter.com/rajdavies > I work here: http://fusesource.com > My Blog: http://rajdavies.blogspot.com/ > I'm writing this: http://www.manning.com/snyder/ > > > > > >