-
Notifications
You must be signed in to change notification settings - Fork 18k
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: extra stack frames in Go 1.12beta2 compared to 1.11 #29919
Comments
CC @randall77 This is almost certainly a consequence of the fix for #28640. |
Yeah, this doesn't look right. I will try and fix. Init functions are special because they contain some generated code and some user code. The decision to print the frame used to use the actual file/line of the location the call happened. Now it uses the file/line of the function definition. This normally wouldn't matter, but for init functions. Possibly we could go back to the old method, although it is tricky to get the information to where it is needed. Another fix would be to split out the user code into a separate function. The outer function would be wrapper and the inner function wouldn't be. From the code to generate init functions, we'd pull step 7 into a separate function:
|
Change https://golang.org/cl/159717 mentions this issue: |
Change https://golang.org/cl/159877 mentions this issue: |
Updates #29919 Change-Id: Ibf92c9957f71394f08c1203a29eae35a12021585 Reviewed-on: https://go-review.googlesource.com/c/159877 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Change https://golang.org/cl/167780 mentions this issue: |
The name change init -> init.ializers was initially required for initialization code. With CL 161337 there's no wrapper code any more, there's a data structure instead (named .inittask). So we can go back to just plain init appearing in tracebacks. RELNOTE=yes Update #29919. Followon to CL 161337. Change-Id: I5a4a49d286df24b53b2baa193dfda482f3ea82a5 Reviewed-on: https://go-review.googlesource.com/c/go/+/167780 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?(compiled at the go1.12beta2 tag)
Does this issue reproduce with the latest release?
This has broken some code that was working before, with Go 1.11.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Here is a minimal test case. main.go:
package/testcase.go:
What did you expect to see?
Here is what this program prints with Go 1.11.2:
What did you see instead?
There is an extra
main.init
frame in both traces, plus apackage.init
one. The top-level var initializer is now withinpackage.init
, whereas before, there was no mention in the backtrace.Is this an actual regression in the face of the Go 1 compatibility promise? Or was it wrong for code to rely on this? (Note that our code was examining the result of
runtime.Callers
programmatically.)The text was updated successfully, but these errors were encountered: