-
Notifications
You must be signed in to change notification settings - Fork 971
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(store/odsq4): fix order of opened flag stored #3735
Conversation
Sounds like |
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.
SGTM
We need to store state here for stored q4 to be able to know if we need to close it or not. sync.Once doesn't allow to read if it was executed or not. |
@cristaloleg, see this golang/go#41690 |
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.
good catch!
@cristaloleg, this does not work for this case we need, unfortunately. We need to know if the once actually happened, while the |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## shwap #3735 +/- ##
========================================
Coverage ? 46.68%
========================================
Files ? 314
Lines ? 17820
Branches ? 0
========================================
Hits ? 8319
Misses ? 8490
Partials ? 1011 ☔ View full report in Codecov by Sentry. |
Opened bool was stored before actual value of q4 was updated, which made it possible for concurrent reader to read nil value before it was updated.
Alternatively code can be refactored to use RWMutex instead of Mutex+atomic.Bool, which can improve readability of logic.