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 70679C6D0 for ; Thu, 13 Jun 2013 16:33:22 +0000 (UTC) Received: (qmail 84732 invoked by uid 500); 13 Jun 2013 16:33:21 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 84531 invoked by uid 500); 13 Jun 2013 16:33:21 -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 84505 invoked by uid 99); 13 Jun 2013 16:33:20 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jun 2013 16:33:20 +0000 Date: Thu, 13 Jun 2013 16:33:20 +0000 (UTC) From: "Timothy Bish (JIRA)" To: dev@activemq.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AMQCPP-490) Exception lifetime confusion can cause the application to crash MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMQCPP-490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13682392#comment-13682392 ] Timothy Bish commented on AMQCPP-490: ------------------------------------- Added fixes for the indicated files, if you want to attach tests or add more locations of problems please do. > Exception lifetime confusion can cause the application to crash > --------------------------------------------------------------- > > Key: AMQCPP-490 > URL: https://issues.apache.org/jira/browse/AMQCPP-490 > Project: ActiveMQ C++ Client > Issue Type: Bug > Components: CMS Impl, Decaf > Affects Versions: 3.5.0, 3.6.0, 3.7.0 > Reporter: Jonathan Fortier > Assignee: Timothy Bish > > In changeset #139775, the "decaf::lang::Exception" class changed its ownership policy for its std::exception cause. Before the changeset, Exception class would clone the cause, and after the change, the Exception class took ownership of the std::exception. > However, many code paths still assume that the Exception class will clone the std::exception, which makes the application crash when a std::exception is thrown in their protected region. > Here is a incomplete list of places in the code that makes this bad assumption (line numbers from version 3.7.0): > -decaf\util\concurrent\FutureTask.h, line 272 > -decaf\util\concurrent\FutureTask.h, line 301 > -decaf\util\concurrent\ThreadPoolExecutor.cpp, line 742 > -activemq\core\ActiveMQTransactionContext.cpp, line 646 > -activemq\core\ActiveMQTransactionContext.cpp, line 757 > -decaf\internal\net\tcp\TcpSocket.cpp, line 361 > Note that subclasses of Exception may also be affected, since they normally forward the cause to their parent. > The comments on many of those classes still wrongly indicates that the cause will be cloned. For example, the comments for Exception::Exception(const std::exception*) is inconsistent with the comments for Exception::initCause() > An easy way to reproduce the bug is to throw a std::exception from an onException callback, which should make the application crash. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira