You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Minh Do (JIRA)" <ji...@apache.org> on 2011/05/19 23:41:47 UTC

[jira] [Commented] (AMQ-3214) "InactivityMonitor Async Task" threads leaking

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

Minh Do commented on AMQ-3214:
------------------------------

Hi Gary,

I used java version "1.6.0_20".  However, I do think this issue is on ThreadPoolExecutor so it will happen on all 1.6.x.
The problem is that if we construct a ThreadPoolExecutor like the way the InactivityMonitor.java does, all threads will become core threads and they will not get discarded as they become idle unless we set  ThreadPoolExecutor.allowCoreThreadTimeOut to be true (it is false be default).

I think both ActiveMQ client and server are using the InactivityMonitor class and both will be slow down to a complete stop after a while.

I had a patch on this in our development and I could see the problem is gone.  What I did was the change the way InactivityMonitory construct the asynch task threadpool.




> "InactivityMonitor Async Task" threads leaking
> ----------------------------------------------
>
>                 Key: AMQ-3214
>                 URL: https://issues.apache.org/jira/browse/AMQ-3214
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JMS client, Transport
>            Reporter: Minh Do
>            Priority: Critical
>             Fix For: 5.6.0
>
>         Attachments: threadleak.png
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> -Have a multi-thread consumers running to consumer messages
> -Have Connection to have these :
>        		ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
> 		connectionFactory.setUseAsyncSend(false);
> 		connectionFactory.setDispatchAsync(false);
> 		connectionFactory.setAlwaysSessionAsync(false);
> 		connectionFactory.setAlwaysSyncSend(true);
> -Run the consumers for several hours and profile it
> -You will see there are threads with the name "InactivityMonitor Async Task" being spawning continuously
> This will cause the entire consumer system to slow down eventually due to thread context switching.  
> Suggestion to fix: we should not put a limit on the number of "InactivityMonitor Async Task" threads to be Max Integer.  There is a bug in Java lib that
> it will not stop a thread after a given idle time-to-live. We could fix this in the file InactivityMonitor.java

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira