Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-5447

Memory Leak after shutdown embeded broker with JDBC persistence

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.10.0
    • Fix Version/s: 5.11.0
    • Component/s: Broker, Message Store
    • Labels:
      None
    • Environment:

      Windows7, JDK7

    • Patch Info:
      Patch Available

      Description

      After shutdown embeded activemq broker with JDBC store, 2 'ActiveMQ JDBC PA Scheduled Task' is still alive.
      Because the 2 thread's Thread factory is object of JDBCPersistenceAdapter's inner class, so the object of JDBCPersistenceAdapter can be reached from the 2 threads, JDBCPersistenceAdapter has a field point to BrokerService. So the instance of BrokerService can be reached from the 2 threads.

      So the stopped brokerService cannot be GC.

      The root cause is that when stopping JDBCPersistenceAdapter, only cancelling cleanupTicket without shutdown clockDaemon, that's why the 2 threads are still alive.

      According to http://activemq.apache.org/how-do-i-restart-embedded-broker.html, it's better (more reliable) to instantiate the broker again instead of reuse old broker. So if I restart embeded broker, there will be 1 more BrokerService in memory. I think it's memory leak.

        Attachments

        1. patch.txt
          0.8 kB
          Shi Lei
        2. JDBCPersistenceAdapter.java
          31 kB
          Shi Lei
        3. 2.png
          65 kB
          Shi Lei
        4. 1.png
          29 kB
          Shi Lei

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              shilei812 Shi Lei
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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