activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From A_MAJUM <abhijit.majum...@pivotalsys.com>
Subject Re: ActiveMQ CPP -- program crashes
Date Thu, 27 Aug 2009 20:20:35 GMT

Hi Tim

Thanks for your response. 

I my project I do clean up from another thread, but .....

in the test program (producer.cpp) I am not cleaning up from another thread.
If you take a look at producer.cpp attached to the original post ----- from
main() I instantiate my class (which creates CMS objects) and then call
run() ( I dont use the class as a separate thread). Inside the run() I check
an error flag. If it is set then I cleanup. Everything is done in the
context of the main thread of the program.

--Abhi




Timothy Bish wrote:
> 
> On Wed, 2009-08-26 at 14:11 -0700, A_MAJUM wrote:
>> Hi
>> 
>> I am trying to use ActiveMQ-CPP in my application. Everything went fine
>> ---
>> but all the hell broke loose when I restarted the ActiveMQ broker. When
>> the
>> broker is stopped my onException function is invoked. I set a flag there
>> and
>> in a different function I close the connection and session objects. It
>> looks
>> like ultimately closing a session or connection will try to flush the
>> socket
>> output stream --- this gives rise to broken pipe error and my application
>> crashes.
>> 
>> Please help me!! I cannot proceed without fixing this issue as it makes
>> our
>> product extremely unreliable. If there is any work-around, please let me
>> know. I went through the forum found some similar issues, but not exactly
>> like my case. Those issues are old too.
>> 
>> Note that I can reproduce this issue EVERY SINGLE TIME.
>> 
>> I am attaching a small program to reproduce it. I cut down the chat
>> example
>> to the bare minimum and tried to recreate the issue in cleanup(). After
>> starting the program I stopped the broker. Although no broken pipe is
>> displayed on the screen it stopped suddenly without going through the
>> entire
>> cleanup() function. The gdb shows there is a broken pipe problem (trace
>> is
>> given below).
> 
> I'd recommend not calling the cleanup routine from the context of a
> thread that's not the one where those resources were allocated.  Also
> the 3.0 client supports failover, so you could use that and allow the
> client to automatically fail to another broker.
> 
> Regards
> Tim.
> 
>> 
>> I am using --
>> 
>> 1. activemq 5.20
>> 2. activemq-CPP 3.0.1
>> 3. apr 1.3.5
>> 4. apr-util 1.3.8
>> 5. Fedora core 9
>> 
>> 
>> The backtrace of gdb ---
>> 
>> 
>> #0  0x00110416 in __kernel_vsyscall ()
>> #1  0x0024b00b in write () from /lib/libc.so.6
>> #2  0x0012a1e8 in apr_socket_send (sock=0x8c16620, buf=0x8c0f830 "",
>> len=0xbf8fde84) at network_io/unix/sendrecv.c:41
>> #3  0x009b26b0 in decaf::net::SocketOutputStream::write (this=0x8c0f130,
>> buffer=0x8c0f830 "", offset=0, len=50) at
>> decaf/net/SocketOutputStream.cpp:96
>> #4  0x0099747b in decaf::io::BufferedOutputStream::emptyBuffer
>> (this=0x8c0f778) at decaf/io/BufferedOutputStream.cpp:96
>> #5  0x00997b7d in decaf::io::BufferedOutputStream::flush (this=0x8c0f778)
>> at
>> decaf/io/BufferedOutputStream.cpp:113
>> #6  0x00801e90 in decaf::io::FilterOutputStream::flush (this=0x8c0fca8)
>> at
>> ./decaf/io/FilterOutputStream.h:189
>> #7  0x008327df in activemq::transport::IOTransport::oneway
>> (this=0x8c0efa0,
>> command=@0xbf8fe144) at activemq/transport/IOTransport.cpp:131
>> #8  0x00833e00 in activemq::transport::TransportFilter::oneway
>> (this=0x8c0eff8, command=@0xbf8fe144) at
>> ./activemq/transport/TransportFilter.h:129
>> #9  0x0087fde8 in
>> activemq::wireformat::openwire::OpenWireFormatNegotiator::oneway
>> (this=0x8c0fd58, command=@0xbf8fe144)
>>     at activemq/wireformat/openwire/OpenWireFormatNegotiator.cpp:76
>> #10 0x00837195 in
>> activemq::transport::correlator::ResponseCorrelator::oneway
>> (this=0x8c0feb8,
>> command=@0xbf8fe144)
>>     at activemq/transport/correlator/ResponseCorrelator.cpp:58
>> #11 0x007bc657 in activemq::core::ActiveMQConnection::oneway
>> (this=0x8c0ff90, command=
>>       {<decaf::lang::AtomicRefCounter> = {counter = 0xbf8fe138},
>> _vptr.Pointer = 0xbf8fe144, value = 0x13354a}) at
>> activemq/core/ActiveMQConnection.cpp:547
>> #12 0x007bde96 in activemq::core::ActiveMQConnection::disposeOf
>> (this=0x8c0ff90, objectId=@0xbf8fe1d0) at
>> activemq/core/ActiveMQConnection.cpp:597
>> #13 0x007ebbc9 in activemq::core::ActiveMQSession::close (this=0x8c3cb68)
>> at
>> activemq/core/ActiveMQSession.cpp:155
>> #14 0x0804975d in HelloWorldProducer::cleanup ()
>> #15 0x08049ce1 in HelloWorldProducer::run ()
>> #16 0x080491a8 in main ()
>> 
>> 
>> 
>> thanks in advance
>> Abhi  http://www.nabble.com/file/p25158290/producer.cpp producer.cpp 
> -- 
> Tim Bish
> http://fusesource.com
> http://timbish.blogspot.com/
> 
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-CPP----program-crashes-tp25158290p25179242.html
Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.


Mime
View raw message