-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
.*: Add new http-grace-period flag #1680
Conversation
79164ed
to
882780b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! One comment and LGTM, maybe we could increase timeout a bit.
Wonder can we have similiar for gRPC 🤔 ? We would need something like grpc/grpc-go#2448
Also we used to have no timeout I guess? So adding 5s make sense. We were not draining even really.
We would need something like grpc/grpc-go#2448
@bwplotka Yes, definitely. Great idea, I'll add a grace period and draining logic for gRPC as well in another PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, LGTM. 👍
Thanks!
you need to sign commits + CI failure |
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Co-Authored-By: Bartlomiej Plotka <bwplotka@gmail.com> Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com>
2bc7b6f
to
c54e35d
Compare
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 <vmg@strn.cat>
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 <vmg@strn.cat>
* Add new http-grace-period flag Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com> * Update CHANGELOG Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com> * Update docs Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com> * Update pkg/server/http.go Co-Authored-By: Bartlomiej Plotka <bwplotka@gmail.com> Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com> * Rename initializer for HTTP server Signed-off-by: Kemal Akkoyun <kakkoyun@gmail.com> Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
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 <vmg@strn.cat> Signed-off-by: Giedrius Statkevičius <giedriuswork@gmail.com>
This is great! I really like the new package and grace period is definitely good thing to have 👍 |
This PR adds a new CLI flag to components which serve HTTP, called
--http-grace-period
.Also refactors existing code and introduces a new HTTP server package, to increase the clarity of the
run.Group
scheduling.cc @bwplotka @FUSAKLA
Signed-off-by: Kemal Akkoyun kakkoyun@gmail.com
Changes
--http-grace-period
CLI flag to components which serve HTTP.scheduleHTTPServer
function and introduces a new package to handle HTTP serving.Verification
make local-test
./scripts/quickstart.sh