-
Notifications
You must be signed in to change notification settings - Fork 590
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
Fix race conditions in otelsarama.WrapAsyncProducer
#755
Conversation
Codecov Report
@@ Coverage Diff @@
## main #755 +/- ##
=====================================
Coverage 78.8% 78.8%
=====================================
Files 62 62
Lines 2707 2707
=====================================
Hits 2135 2135
Misses 440 440
Partials 132 132
|
I share this concern. What options do we have for dealing with it? Is it possible for a valid message to be at offest 0 of partition 0, or can we ignore those attributes of both are 0? |
I would simply replace all calls to
I guess that it is possible. Even it would not be, I find an approach with |
Let's do that, then. At least, in this location. I'd prefer to put no additional information on the span than to put incorrect information on it, but when the information is available and usable we should use it. |
@Aneurysm9 Done |
otelsarama.WrapAsyncProducer
otelsarama.WrapAsyncProducer
otelsarama.WrapAsyncProducer
Ensure gRPC ClientStream override methods do not panic
Why
Sample race condition from Splunk's fork:
The race can happen when the goroutine accesses data (Partition and Offset) that might be later processed. Take notice: https://github.com/Shopify/sarama/blob/41df78df10a9ef3c807cbe1f2814001e330fbdf1/async_producer.go#L200-L208
Reference fix: signalfx/signalfx-go-tracing#128
What
Do not access message fields that are set by sarama async producer before they are processed. Moreover do not set attributes based on message partition and offset in such cases.