-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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: server's Shutdown() method is not graceful enough #32116
Comments
Hi @chenjie199234, this is how Go works. When the You'll need some form of synchronization if you want to make I'm closing this, since this is not a Go bug. |
@ALTree I've just run into this same issue, and I'm not sure it should have been closed. The problem is that
Even if this is intended behaviour of |
Fair enough; I'm re-opening this for further investigation (and possibly to be converted to a doc issue). |
call onShutdown with goroutine, a WaitGroup maybe work. but it's not intuitive. |
any update on this issue? |
Hey! I found this issue when browsing code in net/http. I gave it a try and wrote a quick fix, but it might be too complicated. Is there an interest to have this fixed and is this issue suitable for volunteers (newcomers)?
|
There's another issue here where if you call Shutdown twice, the callbacks will be invoked in a new goroutine twice... |
Http server's registered func on shutdown is called in goroutine.
It will be interrupted by end of the process.
The text was updated successfully, but these errors were encountered: