You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Jonathan Fortier (JIRA)" <ji...@apache.org> on 2013/06/13 19:09:22 UTC

[jira] [Updated] (AMQCPP-490) Exception lifetime confusion can cause the application to crash

     [ https://issues.apache.org/jira/browse/AMQCPP-490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jonathan Fortier updated AMQCPP-490:
------------------------------------

    Attachment: Test-AMQCPP-490.patch

Here is a simple test that exercise the bug. Please feel free to modify or move the test in another fixture...

Thanks for your help!
                
> 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
>         Attachments: Test-AMQCPP-490.patch
>
>
> 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