activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: ActiveMQ-CPP - why ResourceLifecycleManager is not synchronized?
Date Fri, 19 Feb 2010 14:59:11 GMT
On Fri, 2010-02-19 at 06:39 -0800, Ivan Pechorin wrote:
> Hi!
> 
> We use ActiveMQ C++ 3.1.0 client in a multi-threaded application. We use
> activemq::cmsutil::SessionPool and activemq::cmsutil::PooledSession. 
> 
> Today the application crashed because methods createCachedProducer and
> createCachedConsumer do not synchronize access to their shared
> ResourceLifecycleManager, and ResourceLifecycleManager itself is not
> thread-safe.
> 
> Relevant parts of the code are:
> 
> activemq\cmsutil\pooledsession.cpp line 101
> 
>             // Add the producer resource to the resource lifecycle manager.
>             pool->getResourceLifecycleManager()->addMessageProducer( p );
> 
> activemq\cmsutil\resourcelifecyclemanager.h line 95:
> 
>         void addMessageProducer( cms::MessageProducer* producer ) {
>             producers.push_back( producer );
>         }
> 
> I think, ResourceLifecycleManager needs to be thread-safe, i.e. we need to
> add synchronization to all of its add* methods.
> 
> Any suggestions? Maybe I misuse SessionPool or PooledSession somehow?
> 
> Best regards, Ivan

You are probably right, I've not used the CMSTemplate stuff much and
nobody has complained until now so its just gone unnoticed.  Care to
work up a patch for it and create an issue?  There's plenty of snippets
showing how we synchronize in the ActiveMQConnection and ActiveMQSession
classes.

Regards


-- 
Tim Bish

Open Source Integration: http://fusesource.com
ActiveMQ in Action: http://www.manning.com/snyder/

Follow me on Twitter: http://twitter.com/tabish121
My Blog: http://timbish.blogspot.com/


Mime
View raw message