Segfault on session or connection cleanup
-----------------------------------------
Key: AMQCPP-257
URL: https://issues.apache.org/activemq/browse/AMQCPP-257
Project: ActiveMQ C++ Client
Issue Type: Bug
Components: CMS Impl, Openwire
Affects Versions: 3.0.1
Environment: Windows Visual Studio 2005
Reporter: Ben Watrous
Assignee: Timothy Bish
I recently moved up to ActiveMQ CPP 3.0 (and now 3.0.1) from 2.2 to take
advantage of the failover transport, and discovered a segfault during testing.
It may be related to my test procedure, but I have found a quick patch to
activemq/core/ActiveMQSession.cpp that seems to resolve the issue.
It appears that in some cases of connection loss, the connection->disposeOf()
call may throw. In which case the Session is left in an invalid state - the
producers or consumer that caused the exception is still in the list, but it
has already been destroyed. This leads to an invalid pointer access later on.
In the current test, the exception is thrown because the connection to the
broker has been dropped so disposeOf fails.
Test Procedure:
Open the attached example (modified version of the basic sample) in the Visual
Studio debugger.
Set a breakpoint at the "producer->send( message );" line.
Run to breakpoint.
To simulate a broken connection, connect to broker via JMX console and execute
the JMX "Stop" operation on the Connector for the producer.
Continue the debugger.
( Note: I "Purge" the TEST.FOO queue between runs since messages may sometimes
be left in queue during this type of testing. )
Suggested Patch to ActiveMQSession.cpp:
153a154
> try {
155a157,159
> }
> /* Absorb */
> AMQ_CATCHALL_NOTHROW()
1042a1047
> this->consumers.remove( id );
1045c1050
< this->consumers.remove( id );
---
> // this->consumers.remove( id );
1065a1071
> this->producers.remove( id );
1068c1074
< this->producers.remove( id );
---
> // this->producers.remove( id );
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.