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
Graceful shutdown ... isn't #1946
Comments
Reading up with the help of https://dev.to/mokiat/proper-http-shutdown-in-go-3fji |
draft PR #1951 improves this a bit, but I can't get in-flight requests to continue processing for a grace period. Details in the draft PR |
This changes the incorrect-but-at-least-stops implementation with a little tree of goroutines. The full fix requires `context.WithoutCancel`, which we can't quite use yet. Closes: #1946 Signed-off-by: Hank Donnay <hdonnay@redhat.com>
I took a whack at this in #1954, but I think it will require go1.21 API to work correctly. |
This changes the incorrect-but-at-least-stops implementation with a little tree of goroutines. The full fix requires `context.WithoutCancel`, which we can't quite use yet. Closes: quay#1946 Signed-off-by: Hank Donnay <hdonnay@redhat.com>
This changes the incorrect-but-at-least-stops implementation with a little tree of goroutines. The full fix requires `context.WithoutCancel`, which we can't quite use yet. Closes: quay#1946 Signed-off-by: Hank Donnay <hdonnay@redhat.com>
Description of Problem / Feature Request
cmd/clair/main.go
installs a signal handler (SIGINT only) to perform a graceful shutdown.I don't think this is working as desired
Expected Outcome
I would have expected HTTP servers to stop accepting new connections, then a short grace period for in-flight requests to complete (exiting as soon as no requests are in flight), as a last resort terminating connections then exiting if any are still running when the grace period expires.
Actual Outcome
HTTP servers are shutdown immediately, with any in-flight HTTP requests being severed.
Recreate:
go run ./cmd/clair/ -conf ./local-dev/clair/config-frostmar-local.yaml -mode indexer
curl -H "Content-Type: application/json" http://localhost:6060/indexer/api/v1/index_report -d ...<snipped>...
go run
command, orkill -INT <pid>
=> logs output
gracefully shutting down component=main signal=interrupt
=> process immediately exits
=> curl request immediately gives error
curl: (52) Empty reply from server
I'd hope to see:
=> logs to output
gracefully shutting down component=main signal=interrupt
=> 10 sec grace-period timeout
=> process exits only after the grace period
=> logs to output
unregistered signal handler
=> curl to fail with an error response
Environment
Running locally on a Mac
v4.7.2
uname -a
):kubectl version
): n/aThe text was updated successfully, but these errors were encountered: