You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[9.2](backport #49796) Split BeatV2ManagerStart into two methods, so Beats can reply to check-in in parallel to its initialisation (#49849)
The Start method from BeatV2Manager is split into two methods:
- PreInit: responsible for starting the Elastic Agent client and
start replying to check-ins.
- PostInit: responsible for setting the Beats status to 'Running' and
start executing Unit changes.
A new method, WaitForStop is also added. It stops the BeatV2Manager
and waits until all goroutines have returned. Currently it is only
used in tests that use `testing.T` as the logger output to ensure no
panics happen because the logger was used after the test ended.
Multiple lint warnings are fixed
GenAI-Assisted: Yes
Human-Reviewed: Yes
Tool: Cursor-CLI, Model: GPT-5.3 Codex Extra High Fast
(cherry picked from commit 034546f)
# Conflicts:
# x-pack/libbeat/management/managerV2.go
# x-pack/osquerybeat/beater/osquerybeat_status_test.go
* Fix race that can block managerV2 shutdown (#49414)
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)
---------
Co-authored-by: Tiago Queiroz <tiago.queiroz@elastic.co>
Co-authored-by: Fae Charlton <fae.charlton@elastic.co>
0 commit comments