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
250 stars 202 forks source link

Failed to lock trigger #197

Closed alfredods closed 4 years ago

alfredods commented 4 years ago

Hello,

it seems that the problem is not new.

I define a Job and a Trigger, assign names using timestamps and all possible hints that I read on some forums, but I can not solve the problem using mongoDB as jobStore and the class com.novemberain.quartz.mongodb.MongoDBJobStore. I get the error:

quartz.mongodb.LockManager : Failed to lock trigger MarketPlaceGroup.TraderPortalTrigger1594123818411, reason: WriteError{code=11000, message='E11000 duplicate key error collection: pure-market-places.quartz_locks index: keyGroup_1_keyName_1_type_1 dup key: { keyGroup: "MarketPlaceGroup", keyName: "TraderPortalTrigger1594123818411", type: "t" }', details={}}

What is amazing I begin with a complete empty set of collections. There is no quartz_locks yet, but the problem always appears.

Do you have any idea what is wrong?

Best regards

Alfredo

alfredods commented 4 years ago

Hello,

I solve the problem removing the index on mongoDB and creating it again. This is but a very manual solution but at this moment works fine.

Regards

Alfredo

michaelklishin commented 4 years ago

Distributed locks are hard. Lock TTL is the only known solution. Pull requests that add support for lock TTL would be considered. Otherwise, there isn't much this tool can do as "breaking locks" is a terrible workaround.