-
Notifications
You must be signed in to change notification settings - Fork 263
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
Graceful shutdown not working with keep-alive #853
Comments
Yup, this looks like a bug. Worse than just not shutting down, requests keep being handled after shutdown (though that's not entirely unexpected all things considered):
while I was talking to the server as follows:
(Sequence was 1. |
Thus, I think this behaviour must be explicitly specified as not a bug. Moreover If you check different web servers, then you'll find that it's implemented in a similar way. |
@swamp-agr That is not true, Nginx does close the connection as soon as a response has been sent, e.g. see https://trac.nginx.org/nginx/ticket/1022 and also this is easy to test. Start it, then with |
I encountered unexpected behaviour with the graceful shutdown method. I have the following code:
Now when I run this and send a sigint, the program will shut down properly. However, when I request
localhost:3000
in my browser, and then ask the server to shutdown, it will always take up the full grace period:However, this is unexpected, as there were no request coming in at this moment at all, so the server could have shut down immediately. As this does not happen when I make requests in other ways, I assume it is related to the fact that the browser sends a
Connection: keep-alive
header and keeps the connection alive. This alive connection probably stops the graceful shutdown from terminating, even though no requests are being made.Is this by design, or can this be solved? With this behaviour I think the graceful shutdown has little value, while it could be a quite useful tool.
The text was updated successfully, but these errors were encountered: