-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
clientv3/concurrency.Mutex.Lock() - preserve invariant #10153
clientv3/concurrency.Mutex.Lock() - preserve invariant #10153
Conversation
dd46a9f
to
1d624bb
Compare
Codecov Report
@@ Coverage Diff @@
## master #10153 +/- ##
==========================================
+ Coverage 71.54% 71.71% +0.16%
==========================================
Files 390 390
Lines 36307 36306 -1
==========================================
+ Hits 25975 26036 +61
+ Misses 8530 8461 -69
- Partials 1802 1809 +7
Continue to review full report at Codecov.
|
Convenient invariant: - if werr == nil then lock is supposed to be locked at the moment. While we could not be confident in stronger invariant ('is exactly locked'), it were inconvenient that previous code could return `werr == nil` after Mutex.Unlock. It could happen when ctx is canceled/timeouted exactly after waitDeletes successfully returned werr == nil and before `<-ctx.Done()` checked. While such situation is very rare, it is still possible. fixes etcd-io#10111
1d624bb
to
64e8b2e
Compare
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, defer to @xiang90
lgtm. Thanks for fixing. |
lgtm |
@jingyih Sounds good. Could you also update the changelogs as we backport? Thanks! |
…3-origin-release-3.3 clientv3: automated cherry pick of #10153 to release-3.3
…3-origin-release-3.2 clientv3: automated cherry pick of #10153 to release-3.2
…3-origin-release-3.1 clientv3: automated cherry pick of #10153 to release 3.1
Convenient invariant:
While we could not be confident in stronger invariant ('is exactly locked'),
it were inconvenient that previous code could return
werr == nil
whenit released Lock.
It could happen when ctx is canceled/timeouted exactly after waitDeletes
successfully returned werr == nil and before
<-ctx.Done()
checked.While such situation is very rare, it is still possible.
fixes #10111