You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Evan Kuhn (JIRA)" <ji...@apache.org> on 2010/11/19 21:57:24 UTC

[jira] Created: (AMQCPP-330) Unable to reinitialize ActiveMQ CMS library and then open a session

Unable to reinitialize ActiveMQ CMS library and then open a session
-------------------------------------------------------------------

                 Key: AMQCPP-330
                 URL: https://issues.apache.org/activemq/browse/AMQCPP-330
             Project: ActiveMQ C++ Client
          Issue Type: Bug
          Components: Decaf
    Affects Versions: 3.2.3
         Environment: Windows XP SP2
            Reporter: Evan Kuhn
            Assignee: Timothy Bish
            Priority: Minor


I'm working on a project that initializes and shuts down the ActiveMQ CMS library multiple times.  After upgrading from CMS 3.1.3 to 3.2.3, I noticed that my process crashes after these steps:

1) Initialize ActiveMQ CMS library
2) Create connection, session, etc and do work
3) Shut down ActiveMQ CMS library
4) Initialize ActiveMQ CMS library a second time
5) Create a connection, then a session... crash

First off, am I allowed to reinitialize the CMS library after shutting it down?  Is it recommended not to?

Either way, the program crashes at:

    /main/activemq/transport/tcp/TcpTransport.cpp line 163

I believe the error is in  /main/decaf/net/SocketFactory.cpp.  The static SocketFactory::defaultFactory pointer (line 30) is set while creating the first session.  Then when shutting down the library, the Network object destroys the object pointed to by SocketFactory::defaultFactory.  The next time around, SocketFactory::getDefault() will try to use the pointer, but the factory object has been destroyed, so the process crashes.

One possible fix is to modify the SocketFactory destructor to set the defaultFactory pointer to NULL.  I have no idea if that's a good solution, though.

I will attach a test program to reproduce the crash.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQCPP-330) Unable to reinitialize ActiveMQ CMS library and then open a session

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQCPP-330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63420#action_63420 ] 

Timothy Bish commented on AMQCPP-330:
-------------------------------------

This particular use case isn't really supported by ActiveMQ-CPP, you are welcome to provide a patch for this particular problem but I can't guarantee that everything will work the second time.  Calling the startup method when your application starts and then ensuring that shutdown gets called once when your program exits is the intended use case.  You can register a method with the atexit method defined in stdlib.h

> Unable to reinitialize ActiveMQ CMS library and then open a session
> -------------------------------------------------------------------
>
>                 Key: AMQCPP-330
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-330
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: Decaf
>    Affects Versions: 3.2.3
>         Environment: Windows XP SP2
>            Reporter: Evan Kuhn
>            Assignee: Timothy Bish
>            Priority: Minor
>         Attachments: multi_init_test_main.cpp
>
>
> I'm working on a project that initializes and shuts down the ActiveMQ CMS library multiple times.  After upgrading from CMS 3.1.3 to 3.2.3, I noticed that my process crashes after these steps:
> 1) Initialize ActiveMQ CMS library
> 2) Create connection, session, etc and do work
> 3) Shut down ActiveMQ CMS library
> 4) Initialize ActiveMQ CMS library a second time
> 5) Create a connection, then a session... crash
> First off, am I allowed to reinitialize the CMS library after shutting it down?  Is it recommended not to?
> Either way, the program crashes at:
>     /main/activemq/transport/tcp/TcpTransport.cpp line 163
> I believe the error is in  /main/decaf/net/SocketFactory.cpp.  The static SocketFactory::defaultFactory pointer (line 30) is set while creating the first session.  Then when shutting down the library, the Network object destroys the object pointed to by SocketFactory::defaultFactory.  The next time around, SocketFactory::getDefault() will try to use the pointer, but the factory object has been destroyed, so the process crashes.
> One possible fix is to modify the SocketFactory destructor to set the defaultFactory pointer to NULL.  I have no idea if that's a good solution, though.
> I will attach a test program to reproduce the crash.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (AMQCPP-330) Unable to reinitialize ActiveMQ CMS library and then open a session

Posted by "Evan Kuhn (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQCPP-330?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Evan Kuhn updated AMQCPP-330:
-----------------------------

    Attachment: multi_init_test_main.cpp

Test program to recreate the bug

> Unable to reinitialize ActiveMQ CMS library and then open a session
> -------------------------------------------------------------------
>
>                 Key: AMQCPP-330
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-330
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>          Components: Decaf
>    Affects Versions: 3.2.3
>         Environment: Windows XP SP2
>            Reporter: Evan Kuhn
>            Assignee: Timothy Bish
>            Priority: Minor
>         Attachments: multi_init_test_main.cpp
>
>
> I'm working on a project that initializes and shuts down the ActiveMQ CMS library multiple times.  After upgrading from CMS 3.1.3 to 3.2.3, I noticed that my process crashes after these steps:
> 1) Initialize ActiveMQ CMS library
> 2) Create connection, session, etc and do work
> 3) Shut down ActiveMQ CMS library
> 4) Initialize ActiveMQ CMS library a second time
> 5) Create a connection, then a session... crash
> First off, am I allowed to reinitialize the CMS library after shutting it down?  Is it recommended not to?
> Either way, the program crashes at:
>     /main/activemq/transport/tcp/TcpTransport.cpp line 163
> I believe the error is in  /main/decaf/net/SocketFactory.cpp.  The static SocketFactory::defaultFactory pointer (line 30) is set while creating the first session.  Then when shutting down the library, the Network object destroys the object pointed to by SocketFactory::defaultFactory.  The next time around, SocketFactory::getDefault() will try to use the pointer, but the factory object has been destroyed, so the process crashes.
> One possible fix is to modify the SocketFactory destructor to set the defaultFactory pointer to NULL.  I have no idea if that's a good solution, though.
> I will attach a test program to reproduce the crash.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.