-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[processor/tailsampling] Data race during evaluation #24283
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Thanks for the report, I'll take a look at the PRs. |
You're welcome |
**Description:** This PR contains a fix for a race condition that occurs during policies evaluation in the tail sampling processor. Data race occurs because of concurrent read/write to ptrace.Traces underlying slice (*[]*v1.ResourceSpans).So one of the possible solution is to extend mutex lock to whole Evaluate method. **Link to tracking Issue:** #24283 **Testing:** Added new ConcurrentArrivalAndEvaluation unit test for data race case. **Documentation:** <Describe the documentation added.> --------- Co-authored-by: Juraci Paixão Kröhling <juraci@kroehling.de>
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I think this can be closed, as the PR has been merged. |
Component(s)
processor/tailsampling
What happened?
Description
There is a data race condition during policies evaluation process. A data race occurs when the following events happen concurrently:
The thing is that when we are trying to copy a slice of spans in some evaluation rules, actually we are copying a pointer (1,2) to
reflect.SliceHeader
, not the value. Thus we have concurrent read (evaluation) and write (add spans) for the same slice that could lead to panic.The date race appears for the following evaluation policies:
Steps to Reproduce
Expected Result
There is no panics or data race messages in collector console output
Actual Result
There are panics or data race messages in output
Collector version
v0.81.0
Environment information
any
OpenTelemetry Collector configuration
Log output
Additional context
There is no cheap solution to copy the
ptrace.Traces
underlying slice. Therefore, one the possible fixes is to extend spans lock before evaluation.In my fork I've already fixed the problem and have written some unit test. After applying this solution in production, I haven't noticed any side effects: cpu consumption has remained the same, the processing pipeline hasn't slowed down.
The text was updated successfully, but these errors were encountered: