Skip to content

runtime: lockOSThread error message if init exits #5963

@rsc

Description

@rsc
If runtime.Goexit is called during init, the runtime gets upset.

g% cat ~/x.go
package main
import "runtime"
func init() { runtime.Goexit() }
func main() {}
g% go run ~/x.go
invalid m->locked = 2
fatal error: internal lockOSThread error

goroutine 2 [runnable]:
runtime.MHeap_Scavenger()
    /Users/rsc/g/go/src/pkg/runtime/mheap.c:438
runtime.goexit()
    /Users/rsc/g/go/src/pkg/runtime/proc.c:1313
created by runtime.main
    /Users/rsc/g/go/src/pkg/runtime/proc.c:165
exit status 2
g%

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions