-
Notifications
You must be signed in to change notification settings - Fork 17.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
runtime: unexpected return pc with go1.15 and go1.14 but not go1.13 #43882
Comments
Possibly a dup of #43496 (but this one has a reproducer, that one doesn't). |
cc @danscales |
|
Further minimized: https://play.golang.org/p/vGyzJCZ2Ssq (I'm not planning to investigate this any further. I just felt in the mood for minimizing a compiler test case.) |
This is crash on valid code, but it already fails with 1.14 and 1.15 so not marking as a release blocker for 1.16. Still, if we can fix it for 1.16, that would be nice. |
Change https://golang.org/cl/286712 mentions this issue: |
Thanks for the minimized test case, @mdempsky ! I reduced it further and added it as a test case, and now have a fix. The fix is reasonably small and effects should be minimal, but the runtime handling of open-coded defers is a bit tricky. So, we can decide if we have enough time to test for 1.16, based on reviews, etc. |
I've updated the milestone to reflect that this fix landed in Go 1.16 after all. |
We found this bug (random crash) in real world system but managed to reduce a simple example.
The follow sample should not crash but it does with go1.15.7, go.1.14.14:
https://github.com/bigdrum/deferbug/blob/master/deferbug_test.go
There is possibility of this being a bug in the gin framework. But this isn't re-producible in go1.13.15.
So I suspect this is a regression introduced by the new defer optimization introduced in go1.14.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run the follow test created as a minimum reproducing code:
https://github.com/bigdrum/deferbug
What did you expect to see?
No error.
What did you see instead?
runtime: unexpected return pc for github.com/gin-gonic/gin.RecoveryWithWriter.func1 called from 0x7160f70
stack: frame={sp:0xc0000f7b70, fp:0xc0000f7bb0} stack=[0xc0000f6000,0xc0000f8000)
000000c0000f7a70: 0000000001c3ffff 0000000007160f70
000000c0000f7a80: 0000000007160f70 0000000000000030
000000c0000f7a90: 0000000000000001 000000c0000f7b10
000000c0000f7aa0: 000000000101a625 <runtime.(*mcentral).cacheSpan+517> 0000000007160f70
000000c0000f7ab0: 0000000000000000 000000c0000f7a78
000000c0000f7ac0: 000000000000006c 000000c0000a4060
000000c0000f7ad0: 0000000001464be0 0000000000000000
...
(see https://github.com/bigdrum/deferbug/blob/master/README.md for full output)
The text was updated successfully, but these errors were encountered: