Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
x/net/http2: graceful shutdown support to standalone HTTP/2 server #41418
This is a feature request which follows #4674.
HTTP/2 server only supports graceful shutdown when integrated with the standard
We have a use case where HTTP/2 server is used as a stand-alone server with ALTS instead of TLS as the security layer (https://cloud.google.com/security/encryption-in-transit/application-layer-transport-security?hl=en). It seems impossible to use the graceful shutdown feature currently even if we are willing to start a HTTP server (I could be wrong. Any idea will be very welcome!).
I think making the related functions public can easily fix the issue.
There is also some discussion around generalizing the graceful shutdown in #4674 (comment) .
Its not so simple. Regardless of where we could put StartGracefulShutdown(), the current code lacks most of the guards that are currently provided via http.Server. One such example is preventing new connections from being served once Shutdown is called. Exposing the current shutdown behavior just affects the current connections but does nothing to prevent new ones.
That's right! I totally agree that to implement a complete graceful shutdown, there would be much more work.
But for the standalone use case, it would be relatively easy for users to close listeners and make sure the server waits for existing connections to close. The hard/impossible part is to trigger GOAWAYs (Please correct me if I am wrong). startGracefulShutdown() does exactly that. Instead of calling it StartGracefulShutdown(), we could call it SendGracefulGoawayOnActiveConnections(). What do you think? Thanks!