You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Claudio Corsi (Issue Comment Edited) (JIRA)" <ji...@apache.org> on 2011/11/03 17:17:33 UTC

[jira] [Issue Comment Edited] (AMQ-3577) The Connection is not cleanup properly whenever the close method is called within a thread that was interrupted.

    [ https://issues.apache.org/jira/browse/AMQ-3577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13143273#comment-13143273 ] 

Claudio Corsi edited comment on AMQ-3577 at 11/3/11 4:17 PM:
-------------------------------------------------------------

One more comment, I was able to produce an OOM exception by creating a connection, interrupting the thread and calling the close method in a loop.  

You can see that the connection was never cleaned up properly and eventually the broker slows to a crawl because of the OOM.

With the patch, the broker keeps going without any issues.

The main difference is that the thread count is increasing without the fix and with it the thread count does not.

A simple workaround is that the user calls does the following:

{code}

   // This will clear the interrupted state to allow the connection to cleanup properly
   boolean interrupt = Thread.interrupted();

   connection.close();

   if (interrupted) 
     // This will reset the interrupt state for this thread.
     Thread.currentThread().interrupt();

{code}


                
      was (Author: ccorsi):
    One more comment, I was able to produce an OOM exception by creating a connection, interrupting the thread and calling the close method in a loop.  

You can see that the connection was never cleaned up properly and eventually the broker slows to a crawl because of the OOM.

With the patch, the broker keeps going without any issues.

The main difference is that the thread count is increasing without the fix and with it the thread count does not.

A simple workaround is that the user calls does the following:

{code}

   boolean interrupt = Thread.interrupted();


                  
> The Connection is not cleanup properly whenever the close method is called within a thread that was interrupted.
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-3577
>                 URL: https://issues.apache.org/jira/browse/AMQ-3577
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, JMS client
>    Affects Versions: 5.5.1
>         Environment: any environment.
>            Reporter: Claudio Corsi
>             Fix For: 5.6.0
>
>
> The connection close method does not properly clean up the connection on the broker.
> This is causing a memory leak on the broker because the connection is dangling.
> I have not confirmed that trying to call the close method within a non-interrupted thread will properly cleanup the connection after it was already called within an interrupted thread.
> I have a test case that reproduces this issue and a patch that corrects the problem.

--
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