-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
x/net/http2/h2c: support closure of all connections and graceful shutdown #26682
Comments
Is there a workaround possible for this? As far as I can see it's completely impossible to do at present, as the methods that need to be invoked to gracefully shutdown a connection (eg. |
After poking a bit more, it looks like I can do something like this, which is a pretty horrid hack but does appear to work: h2s := &http2.Server{}
h1s := &http.Server{}
http2.ConfigureServer(h1s, h2s)
// Make use of h2s in a h2c handler…
h1s.Shutdown(ctx) This works because |
That does not work as the Shutdown itself doesn't wait for the h2c connections. See Line 2631 in 86ce1cb
It starts the graceful shutdown of h2c connections in a new goroutine but only wait for the unhijacked connections. |
Sorry, h2c is super low on my priority list. I don't have time to investigate this enough to be helpful here. |
Connections that were upgraded to HTTP/2 by use of the H2cFilter can now be drained properly. The implementation is pretty ugly because Go does not have native support for connection draining on h2c connections, and as per golang/go#26682 this isn't a priority for the project.
Connections that were upgraded to HTTP/2 by use of the H2cFilter can now be drained properly. The implementation is pretty ugly because Go does not have native support for connection draining on h2c connections, and as per golang/go#26682 this isn't a priority for the project.
Connections that were upgraded to HTTP/2 by use of the H2cFilter can now be drained properly. The implementation is pretty ugly because Go does not have native support for connection draining on h2c connections, and as per golang/go#26682 this isn't a priority for the project.
Connections that were upgraded to HTTP/2 by use of the H2cFilter can now be drained properly. The implementation is pretty ugly because Go does not have native support for connection draining on h2c connections, and as per golang/go#26682 this isn't a priority for the project.
Change https://golang.org/cl/185059 mentions this issue: |
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Enables HTTP/2 connections over cleartext TCP with Prior Knowledge (RFC 7540 3.4). The implementation is based on the golang.org/x/net/http2/h2c and workarounds several issues: * golang/go#38064 * golang/go#26682 See h2c package docs for details. Signed-off-by: Alexander Yastrebov <[email protected]>
Would the Go team be open to CLs that address this? (I see that there's a very old CL open, but it doesn't seem to have been reviewed.) h2c is particularly popular in the gRPC ecosystem, and it'd be nice for gRPC implementations built on Is @neild the right person to take a look at |
Work around golang/go#26682 by introducing ShutdownListener that tracks active connections and implements graceful shutdown. For #1253
Works around golang/go#26682 by introducing ShutdownListener that tracks active connections and implements graceful shutdown. For #1253
Works around golang/go#26682 by introducing ShutdownListener that tracks active connections and implements graceful shutdown. For #1253 Signed-off-by: Alexander Yastrebov <[email protected]>
Works around golang/go#26682 by introducing ShutdownListener that tracks active connections and implements graceful shutdown. For #1253 Signed-off-by: Alexander Yastrebov <[email protected]>
I think I've come up with a workaround. The idea is to use custom listener that would wait until connections are closed, see zalando/skipper#2480 |
Works around golang/go#26682 by introducing ShutdownListener that tracks active connections and implements graceful shutdown. For #1253 Signed-off-by: Alexander Yastrebov <[email protected]>
Hi, how's this issue going so far? |
Very happy to see h2c supported: golang/net@c4299a1
However, there is no way to enable graceful shutdown, or even close all h2c connections. We should support this.
You could use
http2.ConfigureServer
to configure a http2 server's graceful shutdown to be called when the http server is shutdown but the http server's shutdown method will not wait for the http2 connections to close because they have been hijacked.I think it'd be simplest if we added a
Shutdown
andClose
method to*http2.Server
analogous to*http.Server
's methods.The text was updated successfully, but these errors were encountered: