-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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] Fix data race in convert processor #17032
Merged
andrewkroh
merged 1 commit into
elastic:master
from
andrewkroh:bugfix/libbeat-convert-proc-concurrency
Mar 16, 2020
Merged
[libbeat] Fix data race in convert processor #17032
andrewkroh
merged 1 commit into
elastic:master
from
andrewkroh:bugfix/libbeat-convert-proc-concurrency
Mar 16, 2020
Conversation
This file contains 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
andrewkroh
added
bug
review
libbeat
needs_backport
PR is waiting to be backported to other branches.
labels
Mar 16, 2020
If the convert processor was used in the global context it could lead to data races because there was a variable that was reused across executions. When processors are used in the global context they are shared across individual publisher clients so you could end up with a data race. The fix here was to replace the shared state with a local variable. In testing this didn't make much of a difference in the number of allocations.
andrewkroh
force-pushed
the
bugfix/libbeat-convert-proc-concurrency
branch
from
March 16, 2020 16:10
f074ccc
to
470fcd7
Compare
adriansr
approved these changes
Mar 16, 2020
Pinging @elastic/integrations (Team:Integrations) |
Pinging @elastic/siem (Team:SIEM) |
andrewkroh
added a commit
to andrewkroh/beats
that referenced
this pull request
Mar 16, 2020
If the convert processor was used in the global context it could lead to data races because there was a variable that was reused across executions. When processors are used in the global context they are shared across individual publisher clients so you could end up with a data race. The fix here was to replace the shared state with a local variable. In testing this didn't make much of a difference in the number of allocations. (cherry picked from commit b6167ae)
2 tasks
andrewkroh
added
v7.7.0
and removed
needs_backport
PR is waiting to be backported to other branches.
labels
Mar 16, 2020
andrewkroh
added a commit
that referenced
this pull request
Mar 19, 2020
If the convert processor was used in the global context it could lead to data races because there was a variable that was reused across executions. When processors are used in the global context they are shared across individual publisher clients so you could end up with a data race. The fix here was to replace the shared state with a local variable. In testing this didn't make much of a difference in the number of allocations. (cherry picked from commit b6167ae)
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.
What does this PR do?
If the convert processor was used in the global context it could lead to data races because there was a variable that was reused across executions. When processors are used in the global context they are shared across individual publisher clients so you could end up with a data race.
The fix here was to replace the shared state with a local variable. In testing this didn't make much of a difference in the number of allocations.
Why is it important?
Data races can lead to panics or incorrect events.
Checklist
How to test this PR locally
cd libbeat/processors/convert && go test -race -cpu 4 -bench . -benchtime=5s -benchmem .