Skip to content
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

sync: recover of panic in Unlock of unlocked Mutex leaves Mutex in odd state #13879

Closed
rogpeppe opened this issue Jan 8, 2016 · 3 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@rogpeppe
Copy link
Contributor

rogpeppe commented Jan 8, 2016

Not necessarily bad behaviour but unexpected:

http://play.golang.org/p/OrPRAXnkdA

I would expect the program to complete here (because
we've recovered from the Unlock panic so the mutex
should not be locked) but it actually
deadlocks before the failed unlock locked the
mutex.

@davecheney
Copy link
Contributor

IMO this kind of panic should not be recoverable. I guess I'm arguing for
runtime.throw vs runtime.panic

On Sat, 9 Jan 2016, 04:23 Roger Peppe notifications@github.com wrote:

Not necessarily bad behaviour but unexpected:

http://play.golang.org/p/OrPRAXnkdA

I would expect the program to complete here (because
we've recovered from the Unlock panic so the mutex
should not be locked) but it actually
deadlocks before the failed unlock locked the
mutex.


Reply to this email directly or view it on GitHub
#13879.

@ianlancetaylor ianlancetaylor added this to the Go1.7 milestone Jan 8, 2016
@rsc rsc changed the title sync: Mutex.Unlock can lock mutex sync: recover of panic in Unlock of unlocked Mutex leaves Mutex in odd state May 18, 2016
@rsc rsc modified the milestones: Go1.8, Go1.7 May 18, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@go101
Copy link

go101 commented Oct 14, 2016

This issue has nothing related to channels, it is just that you can't lock a bad mutex.
Here is a simpler example without channels: https://play.golang.org/p/Xt76u_Tm7w

@gopherbot
Copy link

CL https://golang.org/cl/31359 mentions this issue.

@golang golang locked and limited conversation to collaborators Oct 19, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants