You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Does this issue reproduce with the latest release?
seldomly reproduced
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOHOSTARCH="amd64"
GOVERSION="go1.18.3"
What did you do?
We have a program that runs a net/http server and it keeps two persistent connections with a client. Our program catches users' SIGINT signal and calls net/http.Shutdown() to terminate the server.
Yesterday, I hit Ctrl-c to terminate my program hence the http server, just as uasual, but the program just stuck, hopefully I triggered a pprof and got the full goroutines snapshot, I found my program stuck at the net/http.Shutdown() function.
After reading the documentation and the source code of net/http.Shutdown(), I realized that Shutdown() waits indefinitely for connections to become idle before closing them and returning.
So I think this is just what I encountered: the two persistent connections are too busy to become idle. But I then feel it's really low probable, since according to the source code, the http server turns the connection into idle once it sends the response and Shutdown() checks the connections in a very frequent manner.
I just post it here for some inspiration and see if I am the only lucky man who encountered this issue.
That would be working as expected, maybe you want to set http.Server.BaseContext in your code
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
seldomly reproduced
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
We have a program that runs a net/http server and it keeps two persistent connections with a client. Our program catches users' SIGINT signal and calls
net/http.Shutdown()
to terminate the server.Yesterday, I hit Ctrl-c to terminate my program hence the http server, just as uasual, but the program just stuck, hopefully I triggered a pprof and got the full goroutines snapshot, I found my program stuck at the
net/http.Shutdown()
function.After reading the documentation and the source code of
net/http.Shutdown()
, I realized thatShutdown()
waits indefinitely for connections to become idle before closing them and returning.So I think this is just what I encountered: the two persistent connections are too busy to become idle. But I then feel it's really low probable, since according to the source code, the http server turns the connection into idle once it sends the response and
Shutdown()
checks the connections in a very frequent manner.I just post it here for some inspiration and see if I am the only lucky man who encountered this issue.
btw, the in reality issue I encountered in:
ethereum/go-ethereum#25257
The text was updated successfully, but these errors were encountered: