Ensure the log streamer respects forced shutdown of the agent #3180
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if the agent is sent a sigterm the log streamer will wait for all chunks to be uploaded, and even if a second sigterm is sent we still wait.
Other components of the agent honor the a graceful=false flag which allows operators to force the agent to stop.
This change adds that graceful option to the log streamer stop.
Description
This change introduces immediate cancellation to the log streamer when the agent is forced to stop.
Context
If customers egress is overloaded, or there is a large backlog of chunks to upload, and that is blocked due to internet connectivity issues, the agent can block for extended periods waiting to upload chuncks even if has been "forced" to quit.
Changes
Adds a simple way to signal to the uploader workers to stop work and quite immediately when the agent has been told to exit and cancel.
Testing
go test ./...
). Buildkite employees may check this if the pipeline has run automatically.go fmt ./...
)