Nathan
Nathan

Reputation: 8971

How to Debug a SIGTERM that Causes Abrupt Helidon Server Shutdown

A simple Java program catches kill -SIGTERM and starts the JVM shutdown hooks (i.e., Runtime.addShutdownHook()). When the hooks complete, the JVM shuts down cleanly.

A simple Helidon server has a JVM shutdown hook to ensure the CDI shuts down cleanly. Netty stops listening. I have @BeforeDestroyed, @Destroyed, and JVM shutdown hooks that simply log a message. The hooks log and complete. The server and JVM shut down cleanly.

I have a much more complex Helidon server. I have code that monitors for a special delete file. When I create the delete file, the code detects the file and initiates the shutdown. I see log messages from Netty, @BeforeDestroyed, @Destroyed, and the JVM shutdown hooks. The server and JVM shut down cleanly. The shutdown takes 1.011 seconds.

When I send kill -SIGTERM to the complex Helidon server, the server stops abruptly. Netty does not shut down. The hooks are not called. The server exits within milliseconds.

How do I debug why the server exits abruptly? What could cause the server to exit abruptly upon receiving a SIGTERM?

I can reproduce this problem on Windows (with Cygwin's kill) and Linux.

Upvotes: 0

Views: 146

Answers (0)

Related Questions