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

server: shutdown the actual http server #1689

Merged
merged 1 commit into from
Oct 28, 2019
Merged

Conversation

vmg
Copy link
Contributor

@vmg vmg commented Oct 28, 2019

Hi friends! It seems like #1680 introduced a regression that was preventing Thanos from shutting down cleanly. This fixes it. I did not add a CHANGELOG entry because, well, it's a regression which we fixed early. Let me know if you need me to add one.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Commit message inline for your convenience:

PR #1680 introduced graceful handling for the HTTP server in Thanos, but
the graceful `Shutdown` call was being performed on an `http.Server`
instance that was *not* running at all. The actual server that was
listening for requests was started through `http.Serve`, so there was no
reference to the server struct that we could use to shut it down. This
was causing all of Thanos to freeze after receiving an exit signal,
because the run-group for the HTTP server would never finalize.

This seems like an oversight because the `(*Server).srv` field was being
properly initialized with an HTTP server. Fix this by calling
`ListenAndServe` on our initialized server.

Signed-off-by: Vicent Marti <[email protected]>

Verification

Manually verified that thanos can now be shutdown with a shutdown signal.

cc @antonio

PR thanos-io#1680 introduced graceful handling for the HTTP server in Thanos, but
the graceful `Shutdown` call was being performed on an `http.Server`
instance that was *not* running at all. The actual server that was
listening for requests was started through `http.Serve`, so there was no
reference to the server struct that we could use to shut it down. This
was causing all of Thanos to freeze after receiving an exit signal,
because the run-group for the HTTP server would never finalize.

This seems like an oversight because the `(*Server).srv` field was being
properly initialized with an HTTP server. Fix this by calling
`ListenAndServe` on our initialized server.

Signed-off-by: Vicent Marti <[email protected]>
@kakkoyun
Copy link
Member

@vmg Thanks a lot for fixing that. I guess I made a mistake while trying to ensure parity with the old implementation.

@vmg
Copy link
Contributor Author

vmg commented Oct 28, 2019

🙇❤️

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I think CHANGELOG is only for not released things, so it's all good 👍 Thank you!

@bwplotka bwplotka merged commit 7b4d060 into thanos-io:master Oct 28, 2019
GiedriusS pushed a commit that referenced this pull request Oct 28, 2019
PR #1680 introduced graceful handling for the HTTP server in Thanos, but
the graceful `Shutdown` call was being performed on an `http.Server`
instance that was *not* running at all. The actual server that was
listening for requests was started through `http.Serve`, so there was no
reference to the server struct that we could use to shut it down. This
was causing all of Thanos to freeze after receiving an exit signal,
because the run-group for the HTTP server would never finalize.

This seems like an oversight because the `(*Server).srv` field was being
properly initialized with an HTTP server. Fix this by calling
`ListenAndServe` on our initialized server.

Signed-off-by: Vicent Marti <[email protected]>
Signed-off-by: Giedrius Statkevičius <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants