You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NPE thrown when acquiring next trigger due to null next fire time value #189
During a soak testing of our application using Quartz (version 2.2.3), we notice the following exceptions being thrown from time to time:
org.quartz.core.ErrorLogger ERROR --- An error occurred while scanning for the next triggers to fire.
java.lang.NullPointerException: null
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2837)
... 5 common frames omitted
Wrapped by: org.quartz.JobPersistenceException: Couldn't acquire next trigger: null
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport.java:2864)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$40.execute(JobStoreSupport.java:2759)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$40.execute(JobStoreSupport.java:2757)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3803)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2756)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:272)
Line 2837 of JobStoreSupport.java corresponds to the following code:
...
if (nextTrigger.getNextFireTime().getTime() > batchEnd) {
...
That is getNextFireTime() is null. The API for this method states ...If the trigger will not fire again, null will be returned. It looks like this code needs to check if getNextFireTime() is null before doing a getTime().
We are also getting this error.
We started getting this error after adding 2nd node to cluster. We never got this error with single node.
We see the exception stack trace in logs. 285 in last one month. But, no issue in actual job execution. No failed or pending job.
We only have CRON jobs or Simple JOBS. I don't see any NEXT_FIRE_TIME < 0 in TRIGGERS table. Not sure what is causing the NPE and how to fix that.
We are running cluster with this config.
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.isClustered=true
Hope these details help in fixing the issue. Let me know if you need more details or want me to try out some thing.
Found one more bug report with possible solution. #174
I have updated my config with
org.quartz.jobStore.acquireTriggersWithinLock=true.
Will update in weeks time to confirm whether that solved the problem.
However I should point out that this is not so much as bug than improvement to the code. Per design, there should not be any trigger store in DB with nextFireTime that will return null. If it does, it should already been remove from DB. If we do see this case, there is something wrong with the Trigger implementation of some kind of bad data with this trigger. There is no way to recover from this since it's unexpected. So as code improvement, we log a WARNING. Users should investigate why their trigger is in this state, and manually clean up the data in DB. Please do report new issue if you continue to see this.
Activity
bsiamionau commentedon Dec 26, 2017
Any progress on this?
sudhanmoghe commentedon Jan 8, 2018
We are also getting this error.
We started getting this error after adding 2nd node to cluster. We never got this error with single node.
We see the exception stack trace in logs. 285 in last one month. But, no issue in actual job execution. No failed or pending job.
We only have CRON jobs or Simple JOBS. I don't see any NEXT_FIRE_TIME < 0 in TRIGGERS table. Not sure what is causing the NPE and how to fix that.
We are running cluster with this config.
org.quartz.jobStore.class=org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.oracle.OracleDelegate
org.quartz.jobStore.isClustered=true
Hope these details help in fixing the issue. Let me know if you need more details or want me to try out some thing.
sudhanmoghe commentedon Jan 8, 2018
Found one more bug report with possible solution. #174
I have updated my config with
org.quartz.jobStore.acquireTriggersWithinLock=true.
Will update in weeks time to confirm whether that solved the problem.
quartz-scheduler#189 improv: NPE thrown when acquiring next trigger d…
zemian commentedon Feb 15, 2019
I have put in a PR for this #361
However I should point out that this is not so much as bug than improvement to the code. Per design, there should not be any trigger store in DB with nextFireTime that will return null. If it does, it should already been remove from DB. If we do see this case, there is something wrong with the Trigger implementation of some kind of bad data with this trigger. There is no way to recover from this since it's unexpected. So as code improvement, we log a WARNING. Users should investigate why their trigger is in this state, and manually clean up the data in DB. Please do report new issue if you continue to see this.
Merge pull request #362 from zemian/issue-189-npe-acquire-triggers-ma…
Merge pull request #361 from zemian/issue-189-npe-acquire-triggers
quartz-scheduler#580 fix wrong warning from quartz-scheduler#189 change
quartz-scheduler#580 fix wrong warning from quartz-scheduler#189 change
quartz-scheduler#580 fix wrong warning from quartz-scheduler#189 change
quartz-scheduler#580 fix wrong warning from quartz-scheduler#189 change