-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
net/http: Shutdown method on http server not working properly when using h2 proto in tls config #33191
Comments
@aloababa the example you gave doesn't seem to work. It is throwing an error: "./prog.go:37:38: undefined: syscall.SIGTERM". |
Is undefined only in playground, try to download code and run it on local unix machine. |
Gotcha, thanks. |
Debugs on both sides show proper shutdown. Server side
Client side (nghttp)
|
I made a new test on a different machine. And i still got a different behavior between h2 and http/1.1. When using h2 I got EOF. And when using http/1.1 I got the PID. I sent a SIGTERM before the request was complete. cURL output with http:
cURL output with http2:
|
@fraenkel this is exactly a bug described by OP, server send GOAWAY without waiting for handlers to finish. EDIT: |
Actually, I am not convinced any client is sending a GOAWAY. From the traces and from additional debug, the server receives an EOF rather than any more messages to finish the request. If you do a trace of a clean GET, you will notice that the client does not wait for the GOAWAY from the server. |
Server send GOAWAY. It happens here: Line 3779 in fbb819e
|
Ok, I found some problems:
The graceful shutdown works as expected but curl will complain about malformed HTTP2 frames, and maybe this is bug in curl, because I don't see any wrong HTTP2 packets in Wireshark. UPD: with
I got But with
I don't get any error messages, also found this: https://bugzilla.redhat.com/show_bug.cgi?id=1690971 HTTP2 is hard :( |
/cc @bradfitz |
Looks like duplicate of #39776 fixed by https://go-review.googlesource.com/c/go/+/240278 |
Duplicate of #39776 |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Well when using h2 proto in tls config, calling server.Shutdown will not wait for active connections.
Here is the example:
https://play.golang.org/p/kjFfgwHIvIj
Just use tlsConfig() and tlsConfigWithHTTP2() and send SIGINT while doing a curl.
With http/1.1 proto Shutdown works properly but not with h2 proto.
The text was updated successfully, but these errors were encountered: