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: leftover panic in traceback #8132

Closed
rsc opened this issue Jun 1, 2014 · 2 comments
Closed

runtime: leftover panic in traceback #8132

rsc opened this issue Jun 1, 2014 · 2 comments
Milestone

Comments

@rsc
Copy link
Contributor

rsc commented Jun 1, 2014

The windows builders are failing with a message about leftover panic in traceback,
evidence of a bug in CL 100870044. 

The bug is not windows-specific; windows was just lucky enough to trigger it somewhat
reliably. This variant of the program crashing on windows crashes everywhere.

g% cat x.go
package main

import "runtime"

func main() {
    func() {
        defer func() {
            runtime.GC()
            recover()
        }()
        var x [8192]byte
        func(x [8192]byte) {
            defer func() {
                if err := recover(); err != nil {
                    panic("wrap: " + err.(string))
                }
            }()
            panic("bad")
        }(x)
    }()
}
g% go run x.go
runtime: g16: leftover panic argp=0x2080a3f08 pc=0x2170
fatal error: traceback has leftover defers or panics

runtime stack:
runtime.throw(0x52ff7)
    /Users/rsc/g/go/src/pkg/runtime/panic.c:520 +0x69 fp=0x7fff5fbff2b8 sp=0x7fff5fbff2a0
runtime.gentraceback(0xab36, 0x2208245f48, 0x0, 0x20807c120, 0x0, 0x0, 0x7fffffff,
0x9270, 0x7fff5fbff4a0, 0x0)
    /Users/rsc/g/go/src/pkg/runtime/traceback_x86.c:312 +0x3a3 fp=0x7fff5fbff3a0 sp=0x7fff5fbff2b8
addstackroots(0x20807c120, 0x7fff5fbff4a0)
    /Users/rsc/g/go/src/pkg/runtime/mgc0.c:1692 +0x168 fp=0x7fff5fbff430 sp=0x7fff5fbff3a0
markroot(0x208090480, 0x5)
    /Users/rsc/g/go/src/pkg/runtime/mgc0.c:1321 +0xbe fp=0x7fff5fbff4b0 sp=0x7fff5fbff430
runtime.parfordo(0x208090480)
    /Users/rsc/g/go/src/pkg/runtime/parfor.c:88 +0xa3 fp=0x7fff5fbff528 sp=0x7fff5fbff4b0
gc(0x2208245f60)
    /Users/rsc/g/go/src/pkg/runtime/mgc0.c:2407 +0x1d6 fp=0x7fff5fbff658 sp=0x7fff5fbff528
mgc(0x20807c120)
    /Users/rsc/g/go/src/pkg/runtime/mgc0.c:2349 +0x2e fp=0x7fff5fbff668 sp=0x7fff5fbff658
runtime.mcall(0x20957)
    /Users/rsc/g/go/src/pkg/runtime/asm_amd64.s:181 +0x4b fp=0x7fff5fbff678 sp=0x7fff5fbff668

goroutine 16 [garbage collection]:
runtime.gc(0x2)
    /Users/rsc/g/go/src/pkg/runtime/mgc0.c:2329 +0x1c6 fp=0x2208245f78 sp=0x2208245f48
runtime.GC()
    /Users/rsc/g/go/src/pkg/runtime/malloc.goc:853 +0x26 fp=0x2208245f88 sp=0x2208245f78
main.func·001()
    /Users/rsc/winshare/x.go:8 +0x1e fp=0x2208245fa8 sp=0x2208245f88
----- stack segment boundary -----
runtime.panic(0x272c0, 0x20807a030)
    /Users/rsc/g/go/src/pkg/runtime/panic.c:248 +0x18d fp=0x2208247f50 sp=0x2208247eb8
main.func·002()
    /Users/rsc/winshare/x.go:15 +0xce fp=0x2208247fa8 sp=0x2208247f50
----- stack segment boundary -----
runtime.panic(0x272c0, 0x20807a010)
    /Users/rsc/g/go/src/pkg/runtime/panic.c:248 +0x18d fp=0x2080a3f08 sp=0x2080a3e70
main.func·003(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /Users/rsc/winshare/x.go:18 +0x7f fp=0x2080a3f40 sp=0x2080a3f08
main.func·004()
    /Users/rsc/winshare/x.go:19 +0x94 fp=0x2080a7f48 sp=0x2080a3f40
main.main()
    /Users/rsc/winshare/x.go:20 +0x1a fp=0x2080a7f50 sp=0x2080a7f48
runtime.main()
    /Users/rsc/g/go/src/pkg/runtime/proc.c:247 +0x11a fp=0x2080a7fa8 sp=0x2080a7f50
runtime.goexit()
    /Users/rsc/g/go/src/pkg/runtime/proc.c:1445 fp=0x2080a7fb0 sp=0x2080a7fa8
created by _rt0_go
    /Users/rsc/g/go/src/pkg/runtime/asm_amd64.s:97 +0x120

goroutine 17 [runnable]:
runtime.MHeap_Scavenger()
    /Users/rsc/g/go/src/pkg/runtime/mheap.c:507 fp=0x2208249fa8 sp=0x2208249fa0
runtime.goexit()
    /Users/rsc/g/go/src/pkg/runtime/proc.c:1445 fp=0x2208249fb0 sp=0x2208249fa8
created by runtime.main
    /Users/rsc/g/go/src/pkg/runtime/proc.c:207

goroutine 18 [runnable]:
bgsweep()
    /Users/rsc/g/go/src/pkg/runtime/mgc0.c:1976 fp=0x220822dfa8 sp=0x220822dfa0
runtime.goexit()
    /Users/rsc/g/go/src/pkg/runtime/proc.c:1445 fp=0x220822dfb0 sp=0x220822dfa8
created by runtime.gc
    /Users/rsc/g/go/src/pkg/runtime/mgc0.c:2268
exit status 2
g%
@gopherbot
Copy link

Comment 1:

CL https://golang.org/cl/100900044 mentions this issue.

@rsc
Copy link
Contributor Author

rsc commented Jun 1, 2014

Comment 2:

This issue was closed by revision bcfe519.

Status changed to Fixed.

@rsc rsc added fixed labels Jun 1, 2014
@rsc rsc self-assigned this Jun 1, 2014
@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
We were requiring that the defer stack and the panic stack
be completely processed, thinking that if any were left over
the stack scan and the defer stack/panic stack must be out
of sync. It turns out that the panic stack may well have
leftover entries in some situations, and that's okay.

Fixes golang#8132.

LGTM=minux, r
R=golang-codereviews, minux, r
CC=golang-codereviews, iant, khr
https://golang.org/cl/100900044
@rsc rsc removed their assignment Jun 23, 2022
This issue was closed.
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

2 participants