Steps to Reproduce
- Tested on ZK Fiddle: https://zkfiddle.org/sample/38r3vl2/1-Looping-for-ON-Scheduled-Events
Create and schedule an event that throws an Exception.
Current Result
ZK starts a looping.
Expected Result
The exception should just be thrown once.
Debug Information
When an exception occurs, there is a failure in event execution and proper removal from the queue. Thus, the line responsible for removing the event from the list of events (_schedInfos) that need processing is not executed.
Subsequent events in the queue are processed, restarting the index count used to retrieve events that require treatment (_scheduleInfoReadCount). This results in the repetition of the original event, which fails again and remains in the cache. The cycle persists until the iDempiere service crashes or until the cache (_schedInfos) is cleared after 10 minutes.
DesktopImpl.ScheduleListener.onEvent code
Line 1894 should have a fallback in case of exceptions to remove it from the list of events to be executed, avoiding loops.
Workaround
A workaround to avoid the looping to happens is to apply the needed treatments at the scheduled event to avoid the exception to be thrown.
This prevents the loop to be started at the specific case, if any new exception is discovered, it should be also treated.
DesktopImpl.java
- is duplicated by
-
ZK-5677 Executions.schedule cause infinite loop if async event causes exception
- Closed