Process cannot exit when the SchedulerFactoryBean fails to initialize [SPR-16816] #21356
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
ScienJus opened SPR-16816 and commented
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
destroy
method inSchedulerFactoryBean
, but unfortunately, if an exception is thrown inafterPropertiesSet
, thedestroy
method will not be called, subsequently, these threads will not be closed in the meanwhile.Here are the jstack logs and error logs. You can see that
registerJobsAndTriggers
throws an exception after the scheduler started. So I prepare to catch the invokation of the method and manually call the destroy method when it throwing an exception.I‘d like to create a pull request if you agree with this solution.
Affects: 4.3.17, 5.0.6
Attachments:
Referenced from: pull request #1828, and commits 849b6cc, 0098245, a3bcdbe
Backported to: 4.3.18
The text was updated successfully, but these errors were encountered: