Skip to content
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

libbeat: Stop autodiscover runners in a goroutine #7170

Merged
merged 1 commit into from
May 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ https://github.com/elastic/beats/compare/v6.2.3...master[Check the HEAD diff]
- Fix error if lz4 compression is used with the kafka output. {pull}7025[7025]
- Preserve the event when source matching fails in `add_docker_metadata`. {pull}7133[7133]
- Negotiate Docker API version from our client instead of using a hardcoded one. {pull}7165[7165]
- Fix delays on autodiscovery events handling caused by blocking runner stops. {pull}7170[7170]

*Auditbeat*

Expand Down
6 changes: 5 additions & 1 deletion libbeat/autodiscover/autodiscover.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,12 @@ func (a *Autodiscover) handleStop(event bus.Event) {
}

if runner := a.runners.Get(hash); runner != nil {
// Stop can block, we run it asyncrhonously to avoid blocking
// the whole events loop. The runner hash is removed in any case
// so an equivalent configuration can be added again while this
// one stops, and a duplicated event don't try to stop it twice.
logp.Info("Autodiscover stopping runner: %s", runner)
runner.Stop()
go runner.Stop()
a.runners.Remove(hash)
} else {
logp.Debug(debugK, "Runner not found for stopping: %s", hash)
Expand Down