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

Memory Leak after shutdown embeded broker with JDBC persistence

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.10.0
    • 5.11.0
    • Broker, Message Store
    • None
    • Windows7, JDK7

    • 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. JDBCPersistenceAdapter.java
          31 kB
          Shi Lei
        2. patch.txt
          0.8 kB
          Shi Lei
        3. 1.png
          29 kB
          Shi Lei
        4. 2.png
          65 kB
          Shi Lei

        Activity

          People

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