activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <>
Subject Re: [jira] Resolved: (AMQCPP-271) Connection shutdown crashes if the server went down
Date Sun, 06 Dec 2009 16:38:54 GMT
On Sun, 2009-12-06 at 16:03 +0100, Teemu Torma wrote:
> On Saturday 05 December 2009 21:54:55 Timothy Bish (JIRA) wrote:
> >
> > Just a problem with the examples not shutting down correctly.
> Ok, not really the problem I have, I just thought they were related.
> I traced my problem being DedicatedTaskRunner::shutdown throwing an exception 
> which breaks the session closing.  Shutdown calls Thread::currentThread and in 
> multi-threaded process that is not set.  
> It also looks that ~DedicatedTaskRunner does not guarantee that join is called 
> on the task thread.  I don't know if in practice that ever happens.
> Teemu

The problem addressed was what was causing your error.  The example
created the SimpleAsyncConsumer for instance on the stack of the main
method, which causes the destructor of that class to not be called until
after the shutdownLibrary call in the main method at which point the
objects and methods from the ActiveMQ-CPP and Decaf libraries are not
garunteed to be usable, which resulted in the segfault from the
DedicatedTaskRunner attempting to join its thread.

The method Thread::currentThread won't work after a call to the shutdown
method for the library, which is why its important to clean up your
ActiveMQ-CPP resources for calling it.


Tim Bish

View raw message