golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.11k stars 17.68k forks source link

runtime: unlucky stack split during defer of nil func #8046

Closed dvyukov closed 9 years ago

dvyukov commented 10 years ago
go version devel +fb7122476042 Tue May 20 11:42:25 2014 -0400 linux/amd64

The attached reproducer crashes as (must panic):

$ go run 0.go 
fatal error: unexpected signal during runtime execution
[signal 0xb code=0x1 addr=0x0 pc=0x418e67]

runtime stack:
runtime.throw(0x4603e5)
    src/pkg/runtime/panic.c:520 +0x69 fp=0x7fffda3afc90
runtime.sigpanic()
    src/pkg/runtime/os_linux.c:222 +0x3d fp=0x7fffda3afca8
runtime.gostartcallfn(0x7fffda3afd70, 0x0)
    src/pkg/runtime/stack.c:847 +0x27 fp=0x7fffda3afcc8
runtime.newstack()
    src/pkg/runtime/stack.c:831 +0x6e4 fp=0x7fffda3afe10
runtime: unexpected return pc for runtime.newstackcall called from 0x463e88
runtime.newstackcall(0x421f77, 0x1)
    src/pkg/runtime/asm_amd64.s:275 +0x68 fp=0x7fffda3afe18

goroutine 16 [stack growth]:
runtime.newstackcall(0x0, 0xc208022028)
    src/pkg/runtime/asm_amd64.s:239 fp=0x7f60cc945dc8
runtime.panic(0x42d720, 0x4608fc)
    src/pkg/runtime/panic.c:248 +0x18d fp=0x7f60cc945e60
runtime.panicstring(0x4608fc)
    src/pkg/runtime/panic.c:552 +0x12d fp=0x7f60cc945e88
runtime.panicindex()
    src/pkg/runtime/panic.c:466 +0x27 fp=0x7f60cc945e98
main.id10(0xc208002400, 0x430910, 0x3, 0x0)
    0.go:51 +0xf7 fp=0x7f60cc945f18
main.init()
    0.go:22 +0x69 fp=0x7f60cc945f50
runtime.main()
    src/pkg/runtime/proc.c:240 +0xda fp=0x7f60cc945fa8
runtime.goexit()
    src/pkg/runtime/proc.c:1445 fp=0x7f60cc945fb0
created by _rt0_go
    src/pkg/runtime/asm_amd64.s:97 +0x120

Attachments:

  1. 0.go (3712 bytes)
rsc commented 10 years ago

Comment 1:

Labels changed: added release-go1.3maybe.

Status changed to Accepted.

randall77 commented 10 years ago

Comment 2:

This is also a problem with nil defers.  Although not exactly a duplicate of 8047, I
suspect the same fix will fix both bugs.

Owner changed to @randall77.

Status changed to Duplicate.

Merged into issue #8047.