activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Hartmann (Issue Comment Edited) (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (AMQ-3451) Tomcat 6.0.32 complains that ActiveMQ 5.5 doesn't shutdown a thread
Date Fri, 16 Dec 2011 09:42:30 GMT

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

Andreas Hartmann edited comment on AMQ-3451 at 12/16/11 9:41 AM:
-----------------------------------------------------------------

For me the following seems to work:

Interrupt the TCP transport socket handler daemon thread:

----

Index: activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
===================================================================
--- activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
(revision 1214868)
+++ activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
(working copy)
@@ -380,6 +380,8 @@
         if (serverSocket != null) {
             serverSocket.close();
         }
+        this.socketHandlerThread.interrupt();
+        this.socketHandlerThread = null;
     }
----

Shutdown the task runner factory in a servlet context listener:

----

public class CleanupAmqThreads implements ServletContextListener {

    @Override
    public void contextInitialized(ServletContextEvent sce) {
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        DefaultThreadPools.getDefaultTaskRunnerFactory().shutdown();
    }
}

                
      was (Author: andreas@apache.org):
    For me the following seems to work:

Interrupt the TCP transport socket handler daemon thread:

bq. Index: activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
--- activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
(revision 1214868)
+++ activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
(working copy)
@@ -380,6 +380,8 @@
         if (serverSocket != null) {
             serverSocket.close();
         }
+        this.socketHandlerThread.interrupt();
+        this.socketHandlerThread = null;
     }

Shutdown the task runner factory in a servlet context listener:

bq. public class CleanupAmqThreads implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
    }
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        DefaultThreadPools.getDefaultTaskRunnerFactory().shutdown();
    }
}

                  
> Tomcat 6.0.32 complains that ActiveMQ 5.5 doesn't shutdown a thread
> -------------------------------------------------------------------
>
>                 Key: AMQ-3451
>                 URL: https://issues.apache.org/jira/browse/AMQ-3451
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JMS client
>    Affects Versions: 5.5.0
>         Environment: jdk 1.6.0_23 for Linux 64 bit, Ubuntu 11.04
> Tomcat 6.0.32
> Spring 3.0.5
>            Reporter: John Miller
>              Labels: leak, resource
>
> Every time when restarting web application in Tomcat Manager I get messages:
> SEVERE: The web application [/sms] appears to have started a thread named [ActiveMQ Task-3]
but has failed to stop it. This is very likely to create a memory leak.
> With every restart PermGen space is increased and finally i got OutOfMemory error for
PermGen space.
> I use Spring DefaultMessageListenerContainer, and it's shutdown method closes properly
receivers threads. What is "ActiveMQ Task-3" thread and how to close it properly ?

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

        

Mime
View raw message