[9.2](backport #49414) Fix race that can block managerV2 shutdown#49449
Closed
mergify[bot] wants to merge 1 commit into9.2from
Closed
[9.2](backport #49414) Fix race that can block managerV2 shutdown#49449mergify[bot] wants to merge 1 commit into9.2from
mergify[bot] wants to merge 1 commit into9.2from
Conversation
As described in #49388, `BeatV2Manager` can miss the shutdown signal because its `Stop` method notifies the manager by sending to its signal channel `stopChan` rather than closing it, but there are two goroutines that both listen on that channel. This PR changes `Stop` to close the channel rather than just sending. It also removes the second `stopChan` listener in `watchErrChan`, since the main goroutine already calls the context canceler for that helper when `stopChan` unblocks (this isn't strictly necessary but it will keep error states visible for a little longer during shutdown, and is what was previously happening in the "good" path where the main worker received the stop signal first). (cherry picked from commit d39cb49)
6 tasks
Contributor
🤖 GitHub commentsJust comment with:
|
Contributor
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
Contributor
Author
|
This pull request has not been merged yet. Could you please review and merge it @faec? 🙏 |
2 similar comments
Contributor
Author
|
This pull request has not been merged yet. Could you please review and merge it @faec? 🙏 |
Contributor
Author
|
This pull request has not been merged yet. Could you please review and merge it @faec? 🙏 |
belimawr
approved these changes
Apr 1, 2026
6 tasks
Contributor
|
Superseded by #49849 |
Contributor
|
Closing as #49849 already contains those changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
As described in #49388,
BeatV2Managercan miss the shutdown signal because itsStopmethod notifies the manager by sending to its signal channelstopChanrather than closing it, but there are two goroutines that both listen on that channel.This PR changes
Stopto close the channel rather than just sending. It also removes the secondstopChanlistener inwatchErrChan, since the main goroutine already calls the context canceler for that helper whenstopChanunblocks (this isn't strictly necessary but it will keep error states visible for a little longer during shutdown, and is what was previously happening in the "good" path where the main worker received the stop signal first).Checklist
stresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Related issues
This is an automatic backport of pull request #49414 done by [Mergify](https://mergify.com).