-
Notifications
You must be signed in to change notification settings - Fork 23
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
Cancelled heartbeat causes release failures #36
Comments
Can you provide a repro case proving your point? I think I need a clear example to understand your point. |
I could not come up with a repro case, but I followed your reasoning and agree with your suggestion. Thank you. Code updated. |
What I got sometimes by executing the above binary (can't repro 100% because certain race condition needs to happen but it'll be triggered after it's run a few times):
When you see It looks like you fixed already though, thanks! |
Thanks @Yu-Xie |
Here in
Do()
func we are doing this:Due to LIFO, we would cancel heartbeat before releasing the lock. If the lock is heartbeating when ctx is cancelled, the lock might be marked as as Released here. This will cause that when we call
l.Close()
shortly after, we will hit this branch and skip actually releasing the lock.My proposal is to revert the ordering of these 2 defer operations like this so that we release the lock before cancelling the heartbeats.
Thoughts?
The text was updated successfully, but these errors were encountered: