Skip to content
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.Shutdown doc example bug: no exit on error #30641

justinfx opened this Issue Mar 6, 2019 · 2 comments


None yet
3 participants
Copy link

justinfx commented Mar 6, 2019

It appears the doc example that is provided for http.Server.Shutdown has a bug.

The example shows that when the listener returns, it only prints the error as opposed to being fatal. This would cause the process to block on the done channel until SIGINT is actually sent.

Reproduction of bug:

Should the error handling use log.Fatal?


This comment has been minimized.

Copy link

agnivade commented Mar 7, 2019

Ok, so you are talking about cases where the listener returns on its own without calling Shutdown or Close, in which case, it won't be an ErrServerClosed.

Let's see what @bradfitz says.


This comment has been minimized.

Copy link

justinfx commented Mar 7, 2019

That's correct. My included reproduction shows a case where a bad address was provided so the listener fails immediately. But it won't exit because its waiting on the graceful shutdown channel, which never gets touched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.