activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrey Zavodnik (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-4683) Scheduler discards overdue messages on startup
Date Fri, 23 Aug 2013 08:08:53 GMT

    [ https://issues.apache.org/jira/browse/AMQ-4683?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13748380#comment-13748380
] 

Andrey Zavodnik commented on AMQ-4683:
--------------------------------------

The current fix (revision 1516561) makes JobSchedulerImpl to wait on a semaphore until the
"main" thread executes either doStart() or addListener().
This fix has two big issues:
1. If the "main" thread manages to execute addListener() before the JobSchedulerImpl thread
arrives to semaphore wait() point, the JobSchedulerImpl thread will be blocked indefinitely.
2. JobSchedulerImpl is designed to accept an arbitrary number of listeners. This solution
will only work when there is exactly one. If zero, worker will be blocked. If more than one,
there is a chance that listeners number 2 and over will not receive a notification, just like
the first one didn't in the original bug.
                
> Scheduler discards overdue messages on startup
> ----------------------------------------------
>
>                 Key: AMQ-4683
>                 URL: https://issues.apache.org/jira/browse/AMQ-4683
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.8.0
>         Environment: Windows 7 64bit, JDK 1.6.0_26
>            Reporter: Andrey Zavodnik
>            Assignee: Timothy Bish
>            Priority: Critical
>              Labels: scheduler
>             Fix For: 5.9.0
>
>         Attachments: LostScheduledMessagesTest.java
>
>
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message