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

Scheduler discards overdue messages on startup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 5.8.0
    • 5.9.0
    • Broker
    • Windows 7 64bit, JDK 1.6.0_26

    Description

      When message is scheduled for a delivery (using AMQ_SCHEDULED_PERIOD property) it is not posted to the queue, but saved to the scheduler’s repository instead. If Broker instance is shut down at the time for which the message is scheduled for a delivery, the scheduler will try to process the message at the next time broker is started up. Due to a bug in the scheduler implementation such messages may be dismissed rather than posted to the queue depending on the racing conditions inside the JVM.

      Actual bug resides in org.apache.activemq.broker.scheduler.SchedulerBroker.getInternalScheduler() method.
      This method first calls JobSchedulerStoreImpl. getJobScheduler(String name) method which in turn creates an instance of runnable JobSchedulerImpl class and starts it.
      Then SchedulerBroker registers itselfas a listener of the newly created JobSchedulerImpl.
      Unfortunately this may happen after the JobSchedulerImpl have dismissed all the “missed” tasks as “fired” as there were no listeners configured.

      Attachments

        1. LostScheduledMessagesTest.java
          4 kB
          Andrey Zavodnik

        Issue Links

          Activity

            People

              tabish Timothy A. Bish
              andrey.zavodnik Andrey Zavodnik
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: