Return-Path: X-Original-To: apmail-activemq-dev-archive@www.apache.org Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4F4479E54 for ; Fri, 23 Mar 2012 19:14:00 +0000 (UTC) Received: (qmail 74321 invoked by uid 500); 23 Mar 2012 19:14:00 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 74281 invoked by uid 500); 23 Mar 2012 19:14:00 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 74272 invoked by uid 99); 23 Mar 2012 19:14:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 19:14:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Mar 2012 19:13:48 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 6370F3431C8 for ; Fri, 23 Mar 2012 19:13:27 +0000 (UTC) Date: Fri, 23 Mar 2012 19:13:27 +0000 (UTC) From: "Helen Huang (Issue Comment Edited) (JIRA)" To: dev@activemq.apache.org Message-ID: <893798357.9717.1332530007440.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1340475358.52215.1329514497218.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Issue Comment Edited] (AMQCPP-388) AprPool::getAprPool() returns NULL, causing access violation and application crash MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/AMQCPP-388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13236951#comment-13236951 ] Helen Huang edited comment on AMQCPP-388 at 3/23/12 7:11 PM: ------------------------------------------------------------- Hi Timothy, I have tested the new ActiveMQConnection.cpp, but got a "pure function call" exception from ActiveMQConnection::CleanUp(). From the call stack, I found TransportFilter::fire was called before ActiveMQConnection::CleanUp(). msvcr80d.dll!_NMSG_WRITE(int rterrnum=25) Line 198 C msvcr80d.dll!_purecall() Line 54 + 0x7 bytes C activemq-cppud.dll!activemq::core::ActiveMQConnection::cleanup() Line 469 + 0x49 bytes C++ activemq-cppud.dll!activemq::core::ActiveMQConnection::onException(const decaf::lang::Exception & ex={...}) Line 793 C++ > activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::inactivity::InactivityMonitor::onException(const decaf::lang::Exception & ex={...}) Line 314 C++ activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::IOTransport::fire(decaf::lang::Exception & ex={...}) Line 72 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::IOTransport::run() Line 245 C++ activemq-cppud.dll!decaf::lang::ThreadProperties::runCallback(decaf::lang::ThreadProperties * properties=0x0131b718) Line 137 + 0x13 bytes C++ activemq-cppud.dll!`anonymous namespace'::threadWorker(void * arg=0x0131b718) Line 210 + 0x9 bytes C++ msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C msvcr80d.dll!_threadstartex(void * ptd=0x01333ba8) Line 331 C In function TransportFilter::fire(), the listener pointer was NULL at the crash. I guess some other thread might have deleted that listener/ActiveMQConnection while this thread is in ActiveMQConnection::cleanup(). void TransportFilter::fire( const decaf::lang::Exception& ex ) { if( listener != NULL ){ try{ listener->onException( ex ); }catch( ... ){} } } I have put a break point in the destructor of ActiveMQConnection, and found these threads could delete it when the broker goes down: Call Stack 1: activemq-cppud.dll!activemq::core::ActiveMQConnection::~ActiveMQConnection() Line 242 C++ activemq-cppud.dll!activemq::core::ActiveMQConnection::`vbase destructor'() + 0xf bytes C++ activemq-cppud.dll!activemq::core::ActiveMQConnection::`vector deleting destructor'() + 0x4d bytes C++ activemq-cppud.dll!activemq::cmsutil::ResourceLifecycleManager::destroy() Line 135 + 0x20 bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsAccessor::destroy() Line 131 C++ activemq-cppud.dll!activemq::cmsutil::CmsDestinationAccessor::destroy() Line 58 C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::destroy() Line 211 + 0xb bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::doReceive(cms::MessageConsumer * consumer=0x01408d60) Line 632 + 0x1f bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::ReceiveExecutor::doInCms(cms::Session * session=0x01405760) Line 647 + 0xf bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::execute(activemq::cmsutil::SessionCallback * action=0x0130fbf8) Line 446 C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::receive() Line 682 C++ BrokerMonitor.exe!Receiver::ReceiveMessage() Line 95 + 0x18 bytes C++ BrokerMonitor.exe!Receiver::run() Line 129 C++ Call Stack 2: activemq-cppud.dll!activemq::core::ActiveMQConnection::~ActiveMQConnection() Line 242 C++ activemq-cppud.dll!activemq::core::ActiveMQConnection::`vbase destructor'() + 0xf bytes C++ activemq-cppud.dll!activemq::core::ActiveMQConnection::`vector deleting destructor'() + 0x4d bytes C++ activemq-cppud.dll!activemq::cmsutil::ResourceLifecycleManager::destroy() Line 135 + 0x20 bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsAccessor::destroy() Line 131 C++ activemq-cppud.dll!activemq::cmsutil::CmsDestinationAccessor::destroy() Line 58 C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::destroy() Line 211 + 0xb bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::doReceive(cms::MessageConsumer * consumer=0x01408d60) Line 632 + 0x1f bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::ReceiveExecutor::doInCms(cms::Session * session=0x01405760) Line 647 + 0xf bytes C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::execute(activemq::cmsutil::SessionCallback * action=0x0130fbf8) Line 446 C++ activemq-cppud.dll!activemq::cmsutil::CmsTemplate::receive() Line 682 C++ BrokerMonitor.exe!Receiver::ReceiveMessage() Line 95 + 0x18 bytes C++ BrokerMonitor.exe!Receiver::run() Line 129 C++ was (Author: hhuang): Hi Timothy, I have tested the new ActiveMQConnection.cpp, but got a "pure function call" exception from ActiveMQConnection::CleanUp(). From the call stack, I found TransportFilter::fire was called before ActiveMQConnection::CleanUp(). msvcr80d.dll!_NMSG_WRITE(int rterrnum=25) Line 198 C msvcr80d.dll!_purecall() Line 54 + 0x7 bytes C activemq-cppud.dll!activemq::core::ActiveMQConnection::cleanup() Line 469 + 0x49 bytes C++ activemq-cppud.dll!activemq::core::ActiveMQConnection::onException(const decaf::lang::Exception & ex={...}) Line 793 C++ > activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::inactivity::InactivityMonitor::onException(const decaf::lang::Exception & ex={...}) Line 314 C++ activemq-cppud.dll!activemq::transport::TransportFilter::fire(const decaf::lang::Exception & ex={...}) Line 54 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::TransportFilter::onException(const decaf::lang::Exception & ex={...}) Line 47 C++ activemq-cppud.dll!activemq::transport::IOTransport::fire(decaf::lang::Exception & ex={...}) Line 72 + 0x17 bytes C++ activemq-cppud.dll!activemq::transport::IOTransport::run() Line 245 C++ activemq-cppud.dll!decaf::lang::ThreadProperties::runCallback(decaf::lang::ThreadProperties * properties=0x0131b718) Line 137 + 0x13 bytes C++ activemq-cppud.dll!`anonymous namespace'::threadWorker(void * arg=0x0131b718) Line 210 + 0x9 bytes C++ msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C msvcr80d.dll!_threadstartex(void * ptd=0x01333ba8) Line 331 C In function TransportFilter::fire(), the listener pointer was NULL at the crash. I guess some other thread might have deleted that listener/ActiveMQConnection while this thread is in ActiveMQConnection::cleanup(). void TransportFilter::fire( const decaf::lang::Exception& ex ) { if( listener != NULL ){ try{ listener->onException( ex ); }catch( ... ){} } } > AprPool::getAprPool() returns NULL, causing access violation and application crash > ---------------------------------------------------------------------------------- > > Key: AMQCPP-388 > URL: https://issues.apache.org/jira/browse/AMQCPP-388 > Project: ActiveMQ C++ Client > Issue Type: Bug > Components: Decaf > Affects Versions: 3.2.3 > Environment: Windows xp service pack 3, ActiveMQ broker 5.3.1, apr 1.4.2, apr-util 1.3.9, apr iconv 1.2.1 > Reporter: Helen Huang > Assignee: Timothy Bish > Priority: Critical > Fix For: 3.2.3 > > Attachments: AMQCPP-388-Patch.txt, BrokerMonitor.zip > > > Our application that uses activemq c++ client lib crashed with the following dump: > ---------------------------------------------------------------------------------------------------------------------- > Thread 87 - System ID 3780 > Function Arg 1 Arg 2 Arg 3 Source > libapr_1!apr_pvsprintf+8 00000000 0642a188 180eeb94 > activemq_cppu!decaf::lang::Exception::buildMessage+71 0642a188 180eeb74 180eee2c > activemq_cppu!decaf::lang::exceptions::RuntimeException::RuntimeException+4d 180efeec 0642a160 00000097 > activemq_cppu!decaf::lang::ThreadProperties::runCallback+125 180eee2c 180efee0 00000001 > msvcr80!CatchIt+5c 00000000 00000000 00000000 > LIBAPR_1!APR_PVSPRINTF+8In scotapp.dmp the assembly instruction at libapr_1!apr_pvsprintf+8 in C:\scot\dll\libapr-1.dll has caused an access violation exception (0xC0000005) when trying to read from memory location 0x0000002c on thread 87 > -------------------------------------------------------------------------------------------------------------------- > On the call stack, we saw that following function from class decaf::lang::Exception was called: > void Exception::buildMessage( const char* format, va_list& vargs ) { > // Allocate buffer with a guess of it's size > AprPool pool; > // Allocate a buffer of the specified size. > char* buffer = apr_pvsprintf( pool.getAprPool(), format, vargs ); > // Guessed size was enough. Assign the string. > message.assign( buffer, strlen( buffer ) ); > } > The first parameter passed into apr_pvsprintf was NULL, causing the crash. Could you please take a look and see if there is any bug in the activemqcpp code that could cause the problem. Thanks! -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira