-
Notifications
You must be signed in to change notification settings - Fork 464
contrib/Shopify/sarama: Fix possible deadlock in WrapAsyncProducer #907
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
Conversation
Can you please add a regression test for this use case? |
Not in upcoming days. Feel free to add it on your own. PS. Would you also like to have tests to ensure that other channels are closed as well. I do not think these kind of tests make much sense 😉 |
I was referring to a test reproducing the deadlock. |
My personal opinion is that having tests for such stuff isn't any good. I have created a little program that can be used to find concurrency issues connected with both sarama and its instrumentation: https://github.com/pellared/dd-sarama-deadlock-example/blob/409022c77d58d2f4cdb0d5547dc9782b70849c2f/main.go I am able to write a test to detect it however it would assume some internal details and the test may stop working if the implementation changes. I just want to ensure that you REALLY want it. I imagine someone would make some internal changes and then this test would break and a developer would spend an hour (or more) to figure out what this test does (it would have similar complexity to this. P.S. I really have good intentions. If this would not be true, I would simply add a test or even not create this PR in the first place 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. It makes sense. Fine by me. Thanks for pushing this change and for explaining.
* 'v1' of https://github.com/DataDog/dd-trace-go: Implement DD_PROFILING_OUTPUT_DIR for dev/debug (DataDog#924) contrib/go-pg/pg.v10: add INTEGRATION flag check for tests (DataDog#921) contrib/go-redis/redis.v8: optimize BeforeProcess and BeforeProcessPipeline (DataDog#920) CI: check go.sum is up-to-date (DataDog#918) README: Fix go get instructions (DataDog#913) internal/log: Improve API for testing (DataDog#916) ddtrace/tracer: add support for agent discovery endpoint, feature flags, stats & drops (DataDog#859) internal/version: bump to v1.31.0 (DataDog#910) CONTRIBUTING.md: add link to contrib/README.md (DataDog#802) profiler: Disable agentless mode for WithAPIKey (DataDog#906) contrib/Shopify/sarama: fix possible deadlock in WrapAsyncProducer (DataDog#907) contrib/database/sql.tracedConn implement driver.SessionResetter (DataDog#908) ddtrace/opentracer: consider FollowsFrom references as children (DataDog#905) ddtrace/opentracer: add support for opentracing.TracerContextWithSpanExtension (DataDog#855) ddtrace/tracer: follow noDebugStack setting when using SetTag with an error (DataDog#900) contrib/net/http: add a getter to retrieve original round tripper (DataDog#903) ddtrace/tracer: ensure Flush call is synchronous (DataDog#901)
The client can still write to the
input
channel after the goroutine created byWrapAsyncProducer
was already shut down. Therefore the channel should be closed. Otherwise, it will deadlock.For references, it initially fixed here: signalfx/signalfx-go-tracing#128
I had some very dirty test to reproduce it locally but it is not worth putting to the codebase. The test was complex and the bug is pretty obvious.