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

runtime: "invalid pc-encoded table" throw caused by bad cgo traceback [1.16 backport] #45303

Closed
gopherbot opened this issue Mar 30, 2021 · 3 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Mar 30, 2021

@prattmic requested issue #44971 to be considered for backport to the next 1.16 minor release.

@gopherbot please open backport for 1.16 and 1.15. The only workaround is to change the C traceback engine, which isn't usually feasible.

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Mar 30, 2021

Change https://golang.org/cl/305889 mentions this issue: [release-branch.go1.16] runtime: non-strict InlTreeIndex lookup in Frames.Next

Loading

@dr2chase
Copy link
Contributor

@dr2chase dr2chase commented Mar 31, 2021

Sometimes, people using cgo get useless stack traces, and there is no workaround; approving for next dot release.

Loading

@gopherbot
Copy link
Author

@gopherbot gopherbot commented Mar 31, 2021

Closed by merging 887c0d8 to release-branch.go1.16.

Loading

@gopherbot gopherbot closed this Mar 31, 2021
gopherbot pushed a commit that referenced this issue Mar 31, 2021
…ames.Next

When using cgo, some of the frames can be provided by cgoTraceback, a
cgo-provided function to generate C tracebacks. Unlike Go tracebacks,
cgoTraceback has no particular guarantees that it produces valid
tracebacks.

If one of the (invalid) frames happens to put the PC in the alignment
region at the end of a function (filled with int 3's on amd64), then
Frames.Next will find a valid funcInfo for the PC, but pcdatavalue will
panic because PCDATA doesn't cover this PC.

Tolerate this case by doing a non-strict PCDATA lookup. We'll still show
a bogus frame, but at least avoid throwing.

For #44971
Fixes #45303

Change-Id: I9eed728470d6f264179a7615bd19845c941db78c
Reviewed-on: https://go-review.googlesource.com/c/go/+/301369
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
(cherry picked from commit e4a4161)
Reviewed-on: https://go-review.googlesource.com/c/go/+/305889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants