Questions About Transactions
I'm using JobStoreCMT and I'm seeing deadlocks. What can I do?
JobStoreCMT is currently used under heavy load by many sites. It is believed to be free of bugs that can cause deadlock. However, every now and then a user complains of deadlocks. All cases thus far have turned out to be "user error." The list below describes some things to check if you are experiencing deadlocks.
Some databases falsely detect deadlocks when a TX takes a long time. Make sure you have put indexes on your tables (see improving performance of JDBCJobStore).
Make sure you have at least number-of-threads-in-thread-pool + 2 connections in your DataSources.
Make sure you have both a managed and non-managed DataSource configured for Quartz to use.
Make sure that all work you do with the Scheduler interface is done from within a transaction. Accomplish this by using the Scheduler within a SessionBean that has its TX settings "Required" and "Container". Or within a MessageDrivenBean with similar settings. Finally, start a UserTransaction yourself, and commit the work when done.
If your jobs' execute() methods use the Scheduler, make sure a transaction is in progress by using a UserTransaction or by setting the Quartz config property
org.quartz.scheduler.wrapJobExecutionInUserTransaction=true.
I'm using Oracle RAC and I'm seeing deadlocks. What can I do?
Oracle RAC has many limitations relating to transactions and locking. Quartz is known to work fine with Oracle RAC if you're careful about the setup. The
QTZ-149 issue contains some discussion and links that may help you if you're having issues.