Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MisfireHandler cannot recover any triggers if one misfired trigger has errors #1152

Open
dzhg opened this issue Aug 30, 2024 · 1 comment
Open

Comments

@dzhg
Copy link

dzhg commented Aug 30, 2024

This is similar to #48.

In JobStoreSupport.java, recoverMisfiredJobs method has a loop:

        for (TriggerKey triggerKey: misfiredTriggers) {
            
            OperableTrigger trig = 
                retrieveTrigger(conn, triggerKey);

            if (trig == null) {
                continue;
            }

            doUpdateOfMisfiredTrigger(conn, trig, false, STATE_WAITING, recovering);

            if(trig.getNextFireTime() != null && trig.getNextFireTime().getTime() < earliestNewTime)
                earliestNewTime = trig.getNextFireTime().getTime();
        }

It calls retrieveTrigger and might throw an exception due to an invalid cron expression, for example.

Then, the entire transaction will be rolled back as there is no error/exception handling in the loop.

It will result in a defunct misfire recovery. It will run into an infinite state that tries to recover the same misfired triggers without success. All other valid triggers will not be recovered and will be stuck forever.

Questions:

  1. Is this a known issue and by design?
  2. If so, could you please share the background and the reason behind the decision?
  3. Can we handle the retrieveTrigger exception in the loop and unblock the other valid triggers by skipping the erroneous ones?

Thank you!

@lahma
Copy link

lahma commented Aug 31, 2024

In .NET version we made such changes to ensure more robust handling: quartznet/quartznet#1040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants