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: panic while panicking discards error message #52257

Closed
myaaaaaaaaa opened this issue Apr 10, 2022 · 6 comments
Closed

runtime: panic while panicking discards error message #52257

myaaaaaaaaa opened this issue Apr 10, 2022 · 6 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@myaaaaaaaaa
Copy link

myaaaaaaaaa commented Apr 10, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2719610640=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version go1.18 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.18
uname -sr: Linux 5.17.1-arch1-1
/usr/lib/libc.so.6: GNU C Library (GNU libc) stable release version 2.35.

What did you do?

#17671 fixed a hang caused by recursive panicking, but as a side effect, panic messages are now always discarded even if the recursion isn't endless. Is it feasible for the runtime to attempt to print the error even in the middle of a panic, and only stop after reaching a certain recursion depth?

Minimal example is available here: https://go.dev/play/p/IpGNUlM9YFP

What did you expect to see?

fatal error: panic while printing panic value: important error message

stack trace omitted...

What did you see instead?

fatal error: panic while printing panic value

stack trace omitted...
@ianlancetaylor
Copy link
Contributor

I don't see what the runtime can do with an example like that. It can't print the original panic value, because attempting to print it will itself panic. You seem to be suggesting that it should print it anyhow, but there is literally nothing to print. The attempt to find something to print failed.

@ianlancetaylor ianlancetaylor added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Apr 10, 2022
@seankhliao
Copy link
Member

This seems to be asking for printing the second panic value?
Where first is panic(exampleError{}) and second is panic("important error message") that happens when trying to print the first panic.

@myaaaaaaaaa
Copy link
Author

This seems to be asking for printing the second panic value? Where first is panic(exampleError{}) and second is panic("important error message") that happens when trying to print the first panic.

Yes, that's correct. Right now a workaround to get the second panic value printed is to do something like panic(fmt.Sprintf("%v", exampleError{}))

@ianlancetaylor
Copy link
Contributor

Ah, got it, thanks. Sorry for the confusion.

@ianlancetaylor ianlancetaylor added help wanted NeedsFix The path to resolution is known, but the work has not been done. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Apr 11, 2022
@ianlancetaylor ianlancetaylor added this to the Backlog milestone Apr 11, 2022
@myaaaaaaaaa
Copy link
Author

No worries, it's admittedly a fairly bizarre scenario.

I've updated the playground link with a hopefully clearer explanation, copied here for convenience: https://go.dev/play/p/IpGNUlM9YFP

@gopherbot
Copy link

Change https://go.dev/cl/399874 mentions this issue: runtime: avoid panic while panicking discards error message

@dmitshur dmitshur modified the milestones: Backlog, Go1.19 Apr 15, 2022
@golang golang locked and limited conversation to collaborators Apr 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants