Skip to content

runtime: recover is ineffective in some interface method calls #5406

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

Closed
alotabits opened this issue May 4, 2013 · 6 comments
Closed

runtime: recover is ineffective in some interface method calls #5406

alotabits opened this issue May 4, 2013 · 6 comments
Milestone

Comments

@alotabits
Copy link

What steps will reproduce the problem?

Defer a call to an interface method. A call to recover() within the implementing method
will return nil, even if the goroutine is panicking.

If possible, include a link to a program on play.golang.org.

Defer direct method call:    http://play.golang.org/p/Dkwo66X6me
Defer interface method call: http://play.golang.org/p/Pra5_uu1RZ

What is the expected output?

DON'T PANIC

What do you see instead?

PANIC

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Windows

Which version are you using?  (run 'go version')

Tested in playground and at tip with the same results
@remyoudompheng
Copy link
Contributor

Comment 1:

It works properly only if RecoverImp has the same size as a word. In other cases
(smaller or larger), a wrapper method is needed and the function containing recover is
no longer "called" directly.

@bradfitz
Copy link
Contributor

bradfitz commented May 4, 2013

Comment 2:

Nice find!

Labels changed: added priority-soon, removed priority-triage.

Status changed to Accepted.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Labels changed: added compilerbug.

@rsc
Copy link
Contributor

rsc commented Jul 30, 2013

Comment 4:

Labels changed: added go1.2.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2013

Comment 5:

Status changed to Started.

@rsc
Copy link
Contributor

rsc commented Sep 12, 2013

Comment 6:

This issue was closed by revision 7276c02.

Status changed to Fixed.

@rsc rsc added this to the Go1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.2 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants