[
https://issues.apache.org/activemq/browse/AMQCPP-121?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_39222
]
Albert Strasheim commented on AMQCPP-121:
-----------------------------------------
In an attempt to figure out what is going on, I added a print to
ResponseMarshaller::createObject().
When running the program I posted repeatedly on my dual core Windows system, I
see ResponseMarshaller::createObject() being called twice about 80% of the time
before the program exists. The other 20% of the time, there is a third call to
ResponseMarshaller::createObject().
When I run the program on my uniprocessor Linux system, I always (at least for
the 20 times I ran the program), see 3 calls to
ResponseMarshaller::createObject() before the program exits. It seems this
third call is what makes the allocation that ends up leaking.
Starting to look like a race condition maybe?
> Possible memory leak in activemq::transport::IOTransport::run
> -------------------------------------------------------------
>
> Key: AMQCPP-121
> URL: https://issues.apache.org/activemq/browse/AMQCPP-121
> Project: ActiveMQ C++ Client
> Issue Type: Bug
> Affects Versions: 2.1
> Reporter: Albert Strasheim
> Assignee: Nathan Mittler
> Fix For: 2.1
>
>
> There might be a memory leak in activemq::transport::IOTransport::run.
> Valgrind says:
> ==20739== 20 bytes in 1 blocks are definitely lost in loss record 126 of 175
> ==20739== at 0x4005BA5: operator new(unsigned) (vg_replace_malloc.c:163)
> ==20739== by 0x4776995:
> activemq::connector::openwire::marshal::v2::ResponseMarshaller::createObject()
> const (ResponseMarshaller.cpp:40)
> ==20739== by 0x46A433B:
> activemq::connector::openwire::OpenWireFormat::doUnmarshal(activemq::io::DataInputStream*)
> (OpenWireFormat.cpp:239)
> ==20739== by 0x46A48C9:
> activemq::connector::openwire::OpenWireFormat::unmarshal(activemq::io::DataInputStream*)
> (OpenWireFormat.cpp:185)
> ==20739== by 0x46A6E5D:
> activemq::connector::openwire::OpenWireCommandReader::readCommand()
> (OpenWireCommandReader.cpp:71)
> ==20739== by 0x46D3857: activemq::transport::IOTransport::run()
> (IOTransport.cpp:166)
> ==20739== by 0x4667DE7: activemq::concurrent::Thread::runCallback(void*)
> (Thread.cpp:152)
> ==20739== by 0x4963DA: start_thread (in /lib/libpthread-2.5.so)
> ==20739== by 0x3F026D: clone (in /lib/libc-2.5.so)
> The code looks like this:
> void IOTransport::run(){
> try{
> while( !closed ){
> Command* command = reader->readCommand();
> fire( command );
> }
> }
> catch( exceptions::ActiveMQException& ex ){ /*...*/ }
> catch( ... ){ /*...*/ }
> }
> What might be happening here is that readCommand succeeds but that fire
> throws an exception for some reason. If this happens, command won't be freed.
> Not quite sure under what circumstances this happens. If you're not
> convinced, I can try to narrow down the code that causes the leak.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.