Skip to content

runtime: wait for active panic before exit? #3934

@alberts

Description

@alberts
What steps will reproduce the problem?
If possible, include a link to a program on play.golang.org.

http://play.golang.org/p/BbItzr5EAO

package main

import (
        "sync"
)

func run(wg *sync.WaitGroup) {
        defer wg.Done()
        panic("boom")
}

func main() {
        var wg sync.WaitGroup
        wg.Add(1)
        go run(&wg)
        wg.Wait()
}

What is the expected output?

GOMAXPROCS=1 go run lostpanic.go

complete panic is printed

it also runs fine on the playground, I assume GOMAXPROCS=1 there

What do you see instead?

GOMAXPROCS=2 go run lostpanic.go

only about the first line of the panic is printed

Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

linux

Which version are you using?  (run 'go version')

go version weekly.2012-03-27 +62f087306b18

Please provide any additional information below.

Hit this while trying to debug a bigger program. Confusing as hell. :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions