Agents fails due to "Invalid Delay time"
Two different agents fail after the agent complete their tasks. Agents fail during the scheduling of the next run time.
Scenario 1 - Agent execution takes more than 24 hours to complete. Exception occurred directly after agent finished. This agent does not face this problem after every run.
Scenario 2 - Agent execution takes more 12 hours to complete. Exception occurred directly after agent finished. This agent faces this problem after every run.
Scenario 1 - Exception at 20150428T131503.694 GMT: Invalid delay time: -18903353
Scenario 2 - Exception at 20150427T050027.501 GMT: Invalid delay time: -27397
Steps to Reproduce
Schedule the agent to run once daily. Observe the exception after every time the agent completes its task. It has to be restarted daily to run automatically at the scheduled time.
The second agent faces this issue due to a vagary in agent scheduling. The execution can occur slightly before the scheduled time. In case of an Agent scheduled to run daily and at exactly midnight, the agent can begin processing slightly before midnight. If it finishes after midnight it will interfere with the algorithm used to schedule the next run.
For the first agent, the fact that the current execution took over 24 hours to complete made the "next run time" (which is calculated at the beginning of the process, and is checked against the current time at the end of the process) compute to a time in the past.
Alter the second agent to schedule for 5 minutes past midnight (so it will never begin processing in the prior day). Scenario 1 is an expected behavior (and is the best possible outcome for a daily agent whose processing takes more than 24 hours to complete).
100% found this useful