Delete/Add Quartz job and trigger in an outside (non-Quartz) transaction causes strange deadlock from time to time #494
-
Version: 2.4.1.0Expected behaviorWe need to update Quartz (add or remove jobs) and other database tables in a single transaction while Quartz scheduler is working. Actual behaviorIf we have at least one quartz job that triggers once every 1, 5 or 10 minutes and we try to disable it (remove all references of it from Quartz) and also mark it as disabled in our system, in the same transaction, while the scheduler is on, our application will block (or even throw timeout exception) from time to time. From our investigation it seems to be a deadlock happening half in the database and half in Quartz. As soon as the scheduler trying to get next job to run times-out the enable/disable operation (adding or deleting Quartz jobs) completes fine. Steps to reproduceIf we add the delete or add code in the same transaction as our other dbupdates (related to the scheduled jobs). Thank you for your support. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
First of all, I don't recommend fiddling with Quartz data outside of the API. Using scheduler with ZeroSizeThreadPool and not starting it is a nice way to do updates against Quartz tables in maintenance mode. If I understand correctly you are trying to have double bookkeeping by updating scheduling data in your own tables and Quartz's. Ideally you would just Quartz's tables to inform the status of the of the trigger/job. I guess the real problem here is that you would like do issue update to two tables instead of one. That could be achieved by overriding StdAdoDelegate method in a way that you let the base call go through and then issue more command, these would share the transaction. that is provided to the delegate method. However there would be a lot methods to synchronize. These are my thought, hope that I understood the description of your problem well enough. |
Beta Was this translation helpful? Give feedback.
-
Closing due to low activity. |
Beta Was this translation helpful? Give feedback.
First of all, I don't recommend fiddling with Quartz data outside of the API. Using scheduler with ZeroSizeThreadPool and not starting it is a nice way to do updates against Quartz tables in maintenance mode.
If I understand correctly you are trying to have double bookkeeping by updating scheduling data in your own tables and Quartz's. Ideally you would just Quartz's tables to inform the status of the of the trigger/job.
I guess the real problem here is that you would like do issue update to two tables instead of one. That could be achieved by overriding StdAdoDelegate method in a way that you let the base call go through and then issue more command, these would share the transaction. tha…