Rubik-W opened a new issue #2163: [BUG] The master and worker server exit exception URL: https://github.com/apache/incubator-dolphinscheduler/issues/2163 **Describe the bug** The current service exit is implemented by adding a shutdown hook through the Runtime class. When service exit, send service stop notify, depend on Spring been. Spring's exit is also implemented through registration hooks. The hooks inside the Runtime class are maintained through HashMap. Hook is a thread. Hooks run out of order. This will cause the Spring service to be destroyed when the master service exits. DataSource connection pool is closed. May cause exception.  Solution 1.Exit operation is implemented through Spring's @PreDestory. ``` @PreDestroy public void destroy() { ``` --- 2.Avoid loading each other when the master and worker services start `@ComponentScan("org.apache.dolphinscheduler")` change to ``` @ComponentScan(value = "org.apache.dolphinscheduler", excludeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {WorkerServer.class}) }) ``` --- 3.Worker server daemon Plan 1: ``` latch = new CountDownLatch(1); latch.await(); ``` change to ``` public class WorkerServer implements CommandLineRunner { @Override public void run(String... args) throws Exception { Thread.currentThread().join(); } ``` CountDownLatch will block subsequent loading operations of Spring beans, such as @PreDestroy. Plan 2: The thread heartbeatWorkerService set to non-daemon thread. Springboot will not quit after startup. I agree with this plan **Which version of Dolphin Scheduler:** -[1.2.0-preview]
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
