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

packetbeat/beater: prevent double close of pb.done #35324

Merged
merged 1 commit into from
May 4, 2023
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.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ automatic splitting at root level, if root level element is an array. {pull}3415

*Packetbeat*

- Fix double channel close panic when reloading. {pull}35324[35324]

*Winlogbeat*

Expand Down
4 changes: 2 additions & 2 deletions packetbeat/beater/packetbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func (pb *packetbeat) runStatic(b *beat.Beat, factory *processorFactory) error {
select {
case <-pb.done:
case err := <-factory.err:
close(pb.done)
pb.stopOnce.Do(func() { close(pb.done) })
return err
}
return nil
Expand Down Expand Up @@ -187,7 +187,7 @@ func (pb *packetbeat) runManaged(b *beat.Beat, factory *processorFactory) error
// to stop if the sniffer(s) exited without an error
// this would happen during a configuration reload
if err != nil {
close(pb.done)
pb.stopOnce.Do(func() { close(pb.done) })
return err
}
}
Expand Down