Graceful Shutdown stops Jetty server #4770
Replies: 2 comments
-
Hi @ltagliamonte-dd It configures a delayed shutdown handler with a shutdown wait period. Once Jetty receives the signal to shutdown, the delayed shutdown handler (which is registered as the first handler) is triggered and it immediately sets the app's health status to false and then goes to sleep for the duration of the wait period. During this time, your app instance's health check would be returning an unhealthy status to calls to the You can see the lines of code where the Does that help? |
Beta Was this translation helpful? Give feedback.
-
Thank you @pstackle !! |
Beta Was this translation helpful? Give feedback.
-
I'm trying to gracefully shutdown my app on TERM signal.
So far my code look like:
the
delayShutdown
method will set a boolean to false and sleep for N seconds, i'm doing this in order to make the readiness endpoint of my app fail so that Kubernetes will stop sending traffic to my container.The code get correctly executed but I've found out that as soon the TERM signal is received Jetty will close the socket and all in new requests will fail and I don't want this, I need for the server to be fully available until the sleep ends.
Running a while true loop with a test curl on TERM will get me:
I've tried shutdownGracePeriod with no luck:
Would really appreciate the community help on this matter, Thank you!
Beta Was this translation helpful? Give feedback.
All reactions