Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Process cannot exit when the SchedulerFactoryBean fails to initialize [SPR-16816] #21356
For some reason, there is an occasional exception arise from database queries when using quartz's cluster mode. when this exception occurs, the Spring container will close and exit, leaving Java Process suspending.
Through the jstack logs I found that some quartz threads are still running. because they are user threads, the Java process does not exit.
The threads are supposed to close through the
Here are the jstack logs and error logs. You can see that
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: No record found for selection of Trigger with key: 'DEFAULT.bikeLowPowerUpcomingJobTrigger' and statement: SELECT * FROM QRTZ_CRON_TRIGGERS WHERE SCHED_NAME = 'molaQuartzScheduler' AND TRIGGER_NAME = ? AND TRIGGER_GROUP = ? at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1533) at org.quartz.impl.jdbcjobstore.JobStoreSupport$12.execute(JobStoreSupport.java:1522) at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:245) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeWithoutLock(JobStoreSupport.java:3739) at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1519) at org.quartz.core.QuartzScheduler.getTrigger(QuartzScheduler.java:1530) at org.quartz.impl.StdScheduler.getTrigger(StdScheduler.java:508) at org.springframework.scheduling.quartz.SchedulerAccessor.addTriggerToScheduler(SchedulerAccessor.java:291) at org.springframework.scheduling.quartz.SchedulerAccessor.registerJobsAndTriggers(SchedulerAccessor.java:235) at org.springframework.scheduling.quartz.SchedulerFactoryBean.afterPropertiesSet(SchedulerFactoryBean.java:510)
I‘d like to create a pull request if you agree with this solution.
Affects: 4.3.17, 5.0.6
Backported to: 4.3.18
Juergen Hoeller commented
I ended up refactoring
This is on master now; I'll backport it to 5.0.x and 4.3.x tomorrow, along with a few other changes.