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

Cherry-pick #14359 to 7.5: [Filebeat] Race condition fix in S3 input plugin #14402

Merged
merged 1 commit into from
Nov 7, 2019
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 @@ -51,6 +51,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d

- Fix timezone parsing of MySQL module ingest pipelines. {pull}14130[14130]
- Improve error message in s3 input when handleSQSMessage failed. {pull}14113[14113]
- Fix race condition in S3 input plugin. {pull}14359[14359]

*Heartbeat*

Expand Down
11 changes: 8 additions & 3 deletions x-pack/filebeat/input/s3/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,16 +521,21 @@ func s3ObjectHash(s3Info s3Info) string {
}

func (c *s3Context) Fail(err error) {
c.mux.Lock()
defer c.mux.Unlock()
c.setError(err)
c.done()
}

func (c *s3Context) setError(err error) {
// only care about the last error for now
// TODO: add "Typed" error to error for context
c.mux.Lock()
defer c.mux.Unlock()
c.err = err
c.done()
}

func (c *s3Context) done() {
c.mux.Lock()
defer c.mux.Unlock()
c.refs--
if c.refs == 0 {
c.errC <- c.err
Expand Down