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

During startup ActiveMq load all the scheduleDB.data on memory causing OOM

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 5.15.9, 5.16.0
    • 5.15.10, 5.16.0
    • KahaDB
    • None

    Description

      I had a broker with lots of scheduled messages and I noticed that during startup (clean or unclean) the broker was reading the whole index file and storing it os memory:

      https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerImpl.java#L665

      In order to prevent the OOM, I changed this method to return a Iterator<JobLocation> instead of a List<JobLocation> avoiding load all this data into the heap.

       

      I also noticed that during the startup we read the index at least 3 times:

       

      https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerStoreImpl.java#L829

      https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerStoreImpl.java#L857

      and 

      https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerStoreImpl.java#L940

       

      Probably we can optimize this but this should be another Jira (also maybe we dont need to call recover(tx) when its a clean shutdown)

      https://github.com/apache/activemq/blob/master/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/scheduler/JobSchedulerStoreImpl.java#L787

      Attachments

        Issue Links

          Activity

            People

              cshannon Christopher L. Shannon
              alanprot Alan Protasio
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

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