You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2009/12/05 21:54:55 UTC

[jira] Resolved: (AMQCPP-271) Connection shutdown crashes if the server went down

     [ https://issues.apache.org/activemq/browse/AMQCPP-271?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish resolved AMQCPP-271.
---------------------------------

    Resolution: Fixed

Just a problem with the examples not shutting down correctly.

Resolved in trunk and 3.1.x branch

> Connection shutdown crashes if the server went down
> ---------------------------------------------------
>
>                 Key: AMQCPP-271
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-271
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: CMS Impl
>    Affects Versions: 3.1
>         Environment: Ubuntu Jaunty 64bit
>            Reporter: Teemu Torma
>            Assignee: Timothy Bish
>             Fix For: 3.1
>
>
> If the activemq server is brought down while a consumer is active and not using failover transport, the connection close will result in a pure virtual method call, and if using valgrind many errors are reported.
> The problem can be easily shown with the modified example SimpleAsyncConsumer.cpp, by commenting out the exit call in onException method and by not using failover transport.
> Once modified, start the example, shutdown the activemq server and press quit in the example.  
> This has worked fine at least in version 2.2.2, I did not test 3.0.1.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Resolved: (AMQCPP-271) Connection shutdown crashes if the server went down

Posted by Teemu Torma <te...@torma.org>.
On Sunday 06 December 2009 17:38:54 Timothy Bish wrote:
> 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.

I meant that in multi-threading application where a thread that is not 
controlled my activemq-cpp tries to close a session, the Thread::currentThread 
throws because the thread never had a currentThread in the first place.

I tried just to remove the throw and return null pointer and everything 
appears to work fine.  Why not check the thread ids instead of thread 
structures in shutdown?  

Teemu

Re: [jira] Resolved: (AMQCPP-271) Connection shutdown crashes if the server went down

Posted by Timothy Bish <ta...@gmail.com>.
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.

Regards
Tim.


-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/




Re: [jira] Resolved: (AMQCPP-271) Connection shutdown crashes if the server went down

Posted by Teemu Torma <te...@torma.org>.
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