michaelklishin / quartz-mongodb

A MongoDB-based store for the Quartz scheduler. This fork strives to be as feature complete as possible. Originally by MuleSoft.
Other
249 stars 203 forks source link

Error when using high frequency trigger #220

Open intchris1 opened 3 years ago

intchris1 commented 3 years ago

Problem: When using any trigger that runs more often than once in 30 seconds, it often fails with this error:

_LockManager : Failed to lock trigger DEFAULT.sampleTrigger, reason: WriteError{code=11000, message='E11000 duplicate key error collection: SfoScheduler.quartz_locks index: keyGroup_1_keyName_1_type1 dup key: { : "DEFAULT", : "sampleTrigger", : "t" }', details={}}

Trigger executes once, then fails with this error, after sometime recovers and runs fine several times, and then fails with the same error again

Here is a sample project: https://github.com/intchris1/quartz-mongodb-reproduce (Added library to the project because coudn't download repository from bintray)

And there is another issue, I think somehow connected with these locks: If an application loses connection with MongoDB for several seconds and then gets it back, jobs never get executed again until the application restarts Unfortunately I don't have a project reproducing this right now, but we have these two issues in production Both issues encountered when using a single application (not clustered jobstore)