Skip to content

Program hangs on panic() #17671

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
fuyufjh opened this issue Oct 30, 2016 · 4 comments
Closed

Program hangs on panic() #17671

fuyufjh opened this issue Oct 30, 2016 · 4 comments

Comments

@fuyufjh
Copy link

fuyufjh commented Oct 30, 2016

What did you do?

Program hanged when I tried to run this: https://play.golang.org/p/TaFytbEfgu

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

go version go1.7.3 darwin/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/yfu/Workspace/Go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1g/8s88wqg92kg6lprg5kr2bgmr5x3513/T/go-build297531774=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you expect to see?

Panic caused by nil pointer, whatever.

What did you see instead?

Program hanged.

@ALTree
Copy link
Member

ALTree commented Oct 30, 2016

Interesting.. I can reproduce this on 1.7 on Linux, the process is stuck in a loop of some kind, this is a bt:

#0  0x0000000000409438 in runtime.assertE2I2 (inter=0x45b9e0, e=..., r=0xc4218b6328, ~r3=false)
    at /usr/local/go/src/runtime/iface.go:373
#1  0x000000000042252c in runtime.preprintpanics (p=0xc421f2f1b0) at /usr/local/go/src/runtime/panic.go:358
#2  0x000000000042295d in runtime.gopanic (e=...) at /usr/local/go/src/runtime/panic.go:497
#3  0x000000000042157d in runtime.panicmem () at /usr/local/go/src/runtime/panic.go:62
#4  0x0000000000433904 in runtime.sigpanic () at /usr/local/go/src/runtime/sigpanic_unix.go:24
#5  0x0000000000401005 in main.(*MyError).Error (e=0x0, ~r0=...) at /home/adonizetti/Desktop/prova.go:8
#6  0x000000000042254d in runtime.preprintpanics (p=0xc4220ffe40) at /usr/local/go/src/runtime/panic.go:360
#7  0x000000000042295d in runtime.gopanic (e=...) at /usr/local/go/src/runtime/panic.go:497
#8  0x000000000042157d in runtime.panicmem () at /usr/local/go/src/runtime/panic.go:62
#9  0x0000000000433904 in runtime.sigpanic () at /usr/local/go/src/runtime/sigpanic_unix.go:24
#10 0x0000000000401005 in main.(*MyError).Error (e=0x0, ~r0=...) at /home/adonizetti/Desktop/prova.go:8
#11 0x000000000042254d in runtime.preprintpanics (p=0xc4220ffe40) at /usr/local/go/src/runtime/panic.go:360
#12 0x000000000042295d in runtime.gopanic (e=...) at /usr/local/go/src/runtime/panic.go:497
#13 0x000000000042157d in runtime.panicmem () at /usr/local/go/src/runtime/panic.go:62
#14 0x0000000000433904 in runtime.sigpanic () at /usr/local/go/src/runtime/sigpanic_unix.go:24
#15 0x0000000000401005 in main.(*MyError).Error (e=0x0, ~r0=...) at /home/adonizetti/Desktop/prova.go:8
#16 0x000000000042254d in runtime.preprintpanics (p=0xc4220ffe40) at /usr/local/go/src/runtime/panic.go:360
#17 0x000000000042295d in runtime.gopanic (e=...) at /usr/local/go/src/runtime/panic.go:497
#18 0x000000000042157d in runtime.panicmem () at /usr/local/go/src/runtime/panic.go:62
#19 0x0000000000433904 in runtime.sigpanic () at /usr/local/go/src/runtime/sigpanic_unix.go:24
#20 0x0000000000401005 in main.(*MyError).Error (e=0x0, ~r0=...) at /home/adonizetti/Desktop/prova.go:8
#21 0x000000000042254d in runtime.preprintpanics (p=0xc4220ffe40) at /usr/local/go/src/runtime/panic.go:360
#22 0x000000000042295d in runtime.gopanic (e=...) at /usr/local/go/src/runtime/panic.go:497
#23 0x000000000042157d in runtime.panicmem () at /usr/local/go/src/runtime/panic.go:62
#24 0x0000000000433904 in runtime.sigpanic () at /usr/local/go/src/runtime/sigpanic_unix.go:24
#25 0x0000000000401005 in main.(*MyError).Error (e=0x0, ~r0=...) at /home/adonizetti/Desktop/prova.go:8
#26 0x000000000042254d in runtime.preprintpanics (p=0xc4220ffe40) at /usr/local/go/src/runtime/panic.go:360
#27 0x000000000042295d in runtime.gopanic (e=...) at /usr/local/go/src/runtime/panic.go:497
#28 0x000000000042157d in runtime.panicmem () at /usr/local/go/src/runtime/panic.go:62
#29 0x0000000000433904 in runtime.sigpanic () at /usr/local/go/src/runtime/sigpanic_unix.go:24
... and so on ...

It does not hang on tip; it immediately crashes like this:

fatal error: panic while printing panic value
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x44c765]

goroutine 1 [running]:
runtime.throw(0x46a842, 0x20)
    /home/adonizetti/go/src/runtime/panic.go:596 +0x95 fp=0xc42003bce0 sp=0xc42003bcc0
runtime.preprintpanics.func1()
    /home/adonizetti/go/src/runtime/panic.go:385 +0x58 fp=0xc42003bd08 sp=0xc42003bce0
runtime.call32(0x0, 0x46c140, 0x0, 0x0)
    /home/adonizetti/go/src/runtime/asm_amd64.s:501 +0x48 fp=0xc42003bd38 sp=0xc42003bd08
panic(0x45a5c0, 0x499770)
    /home/adonizetti/go/src/runtime/panic.go:489 +0x2d3 fp=0xc42003bdd0 sp=0xc42003bd38
runtime.panicmem()
    /home/adonizetti/go/src/runtime/panic.go:63 +0x5e fp=0xc42003bdf0 sp=0xc42003bdd0
runtime.sigpanic()
    /home/adonizetti/go/src/runtime/signal_unix.go:269 +0x29f fp=0xc42003be40 sp=0xc42003bdf0
main.(*MyError).Error(0x0, 0x459ce0, 0x0)
    /home/adonizetti/Desktop/prova.go:8 +0x5 fp=0xc42003be48 sp=0xc42003be40
runtime.preprintpanics(0xc42003bf30)
    /home/adonizetti/go/src/runtime/panic.go:391 +0xf8 fp=0xc42003bed0 sp=0xc42003be48
panic(0x459ce0, 0x0)
    /home/adonizetti/go/src/runtime/panic.go:528 +0x1ab fp=0xc42003bf68 sp=0xc42003bed0
main.main()
    /home/adonizetti/Desktop/prova.go:16 +0x36 fp=0xc42003bf88 sp=0xc42003bf68
runtime.main()
    /home/adonizetti/go/src/runtime/proc.go:185 +0x20a fp=0xc42003bfe0 sp=0xc42003bf88
runtime.goexit()
    /home/adonizetti/go/src/runtime/asm_amd64.s:2184 +0x1 fp=0xc42003bfe8 sp=0xc42003bfe0

@davecheney
Copy link
Contributor

Ian recently fixed a bug due to a panic during a panic.

This is probably a duplicate.

@0xmohit
Copy link
Contributor

0xmohit commented Oct 30, 2016

7faf702 would have fixed it.

@ianlancetaylor
Copy link
Contributor

Yes, this should be fixed on tip.

@golang golang locked and limited conversation to collaborators Oct 30, 2017
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