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

Exception on creating the schedule - Unable to add lock instance for lock TriggerAccess on NON_CLUSTERED #50

Open
prajasek-netapp opened this issue Sep 20, 2024 · 2 comments

Comments

@prajasek-netapp
Copy link

"Quartz.JobPersistenceException: Unable to add lock instance for lock TriggerAccess on NON_CLUSTERED\n ---> System.Exception: Unable to add lock instance for lock TriggerAccess on NON_CLUSTERED\n at Quartz.Spi.MongoDbJobStore.LockManager.AddLock(LockInstance lockInstance).

This exception is not consistent.

@glucaci
Copy link
Owner

glucaci commented Oct 4, 2024

Hi, thanks for reporting, do you have more details? Current behaviour vs the expected one?

Thanks!

@prajasek-netapp
Copy link
Author

prajasek-netapp commented Oct 7, 2024

Hi, Thanks for the reply, had figured out the issue and fixed.

Current Implementation: The AcquireLock method is designed to return a LockInstance object upon successful lock acquisition. If the attempt fails, the method retries every second. During this process, an entry with a 30-second TTL is created in the lock repository (MongoDB/CosmosDB), and a corresponding entry is added to a concurrent dictionary, keyed by Access Type and Instance ID. The lock is intended to be released upon disposal of the LockInstance object, removing entries from both the lock repository and the concurrent dictionary.

RCA (Root Cause Analysis): If an operation exceeds the 30-second threshold due to network latency or high load, the TTL mechanism will remove the database entry. This allows another instance—or potentially the same instance—to proceed with the pending operation (e.g., Schedule CRUD or Job Trigger). This new operation might successfully create a database record but fail to update the concurrent dictionary if an entry with the same key already exists, leading to operation failure.

Please let me know, so i can send the PR for review.

Thanks,
Raj.

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