-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting Graceful Shutdown #1324
Comments
I think that with this commit it should be OK? |
Thanks! I will check it out and report back. |
Hi @violetagg ,
Here is how I reproduced this. Using Spring's Initializr I created Spring boot app with Gateway dependency (please find attached graceful-shutdown.zip). spring:
cloud:
gateway:
routes:
- id: httpbin
uri: "http://httpbin.org:80"
predicates:
- Path=/delay/{delay} After the Gateway started I made this request that takes 10 seconds to respond. |
@libkad Can you try this
|
Helo,
Thanks |
This could be the solution to stop accepting incoming requests.
|
@violetagg 's solution works fine for me. My spring cloud gateway application is deployed in Kubernetes. |
This is now supported by spring boot 2.3.0 |
Question/Enhancement
When running in a cloud environment, where containers come and go, it's important that in flight requests are not terminated abruptly but rather given time to finish when the container is shutdown. The container platform usually supports this by sending a SIGTERM first, then waiting sometime before finally sending a SIGKILL if necessary. For example see: https://kubernetes.io/docs/concepts/workloads/pods/pod/#termination-of-pods
I don't believe Spring Cloud Gateway (netty) handles SIGTERM at all. The question then is how can we support this on Spring Cloud Gateway. The concept has been discussed here: spring-projects/spring-boot#4657. The thread basically says it not supported generically by Spring Boot, but left to each container to handle. The sample supplied there for Netty doesn't work.
@violetagg Maybe you have some ideas how we can support this?
The text was updated successfully, but these errors were encountered: