ActiveMQ
  1. ActiveMQ
  2. AMQ-3214

"InactivityMonitor Async Task" threads leaking

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.6.0
    • Component/s: JMS client, Transport
    • Labels:
      None

      Description

      -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

        Activity

        Minh Do created issue -
        Minh Do made changes -
        Field Original Value New Value
        Original Estimate 1h [ 3600 ]
        Remaining Estimate 1h [ 3600 ]
        Description -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.
        Component/s JMS client [ 12313896 ]
        Minh Do made changes -
        Summary Re-evaluate the use of ExecutorService.newCachedThreadPool() in places as there are threads leaking. For instance, after profiling, I saw there were over 100 threads with the name "InactivityMonitor Async Task". "InactivityMonitor Async Task" threads leaking
        Description -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.
        -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
        Gary Tully made changes -
        Fix Version/s 5.6.0 [ 12316331 ]
        Fix Version/s 5.5.0 [ 12315626 ]
        Minh Do made changes -
        Attachment threadleak.png [ 12479844 ]
        Timothy Bish made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Gary Tully made changes -
        Fix Version/s 5.6.0 [ 12317974 ]
        Fix Version/s 5.x [ 12316331 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Minh Do
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 1h
              1h
              Remaining:
              Remaining Estimate - 1h
              1h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development