-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 potential deadlock in health streamer #17261
Fix potential deadlock in health streamer #17261
Conversation
Signed-off-by: Manan Gupta <manan@planetscale.com>
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
Tests
Documentation
New flags
If a workflow is added or modified:
Backward compatibility
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #17261 +/- ##
=======================================
Coverage 67.39% 67.39%
=======================================
Files 1570 1573 +3
Lines 252970 253060 +90
=======================================
+ Hits 170484 170559 +75
- Misses 82486 82501 +15 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
If we're able, you could consider swapping this for the fairly new atomic.Bool in Go to eliminate this lock all together! |
I don't think that's possible here, because we depend on a consistent view over multiple fields ( |
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.
LGTM
If a consistent view over multiple fields is necessary then https://pkg.go.dev/sync/atomic#Pointer with a struct is also an option. No strong feelings, just wanted to offer a suggestion to eliminate the lock. |
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.
Looks good
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com>
Signed-off-by: Manan Gupta <manan@planetscale.com> Signed-off-by: Renan Rangel <rrangel@slack-corp.com>
Description
While we fixed a couple of deadlocks in #17230, one was left pending. It was found while testing for deadlocks in #17238.
The deadlock is similar to the ones fixed in #17230, it was occurring between MakePrimary and the reload. The fix employed is to let go of the lock once it is not required instead of defering its unlocking.
Related Issue(s)
Checklist
Deployment Notes