02 January 2018

Quartz Race Condition (in a cluster)

There is race condition (ABA problem)  when using Quartz cluster.
This may be translate in the below stacktrace:

For a strategy coding should not happen, however under certain circumstances, it does. (in particular WebLogic & Oracle DB)

The workaround is to set the following property:
org.quartz.jobStore.acquireTriggersWithinLock=true

As established in the official documentation it shouldn't be necessary:

org.quartz.jobStore.acquireTriggersWithinLock
Whether or not the acquisition of next triggers to fire should occur within an explicit database lock. This was once necessary (in previous versions of Quartz) to avoid dead-locks with particular databases, but is no longer considered necessary, hence the default value is “false”.


<27-dic-2017 12h04="" clt="">  [See nested exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: restricción única (USERS.QRTZ_TRIGGERS_PK) violada
].
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'quartzScheduler' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]: Invocation of init method failed; nested exception is org.quartz.JobPersistenceException: Couldn't store trigger 'DEFAULT.cronTriggerUserNotificacion' for 'DEFAULT.complexJobDetailUserNotificacion' job:ORA-00001: restricción única (USERS.QRTZ_TRIGGERS_PK) violada
 [See nested exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: restricción única (USERS.QRTZ_TRIGGERS_PK) violada
]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    Truncated. see log file for complete stacktrace

No comments :

My Blog List

Blog Archive

There was an error in this gadget

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.