https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61263

            Bug ID: 61263
           Summary: gccgo: fatal error: schedule: holding locks [GoSmith]
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: dvyukov at google dot com

gcc version 4.10.0 20140516 (experimental) (GCC)

The program is:

package main
import "runtime"
import "time"
import "os"
func init() {
    runtime.GOMAXPROCS(2)
    go func() {
        for {
            runtime.GC()
            runtime.Gosched()
        }
    }()
    go func() {
        time.Sleep(3 * time.Second)
        os.Exit(0)
    }()
}
func main() {
    for {
        _ = make(chan []*int, 1)
    }
}

Repro:
Build it with "go build -compiler=gccgo src.go".
Run repeatedly with GOGC=0 (I am running 50 parallel processes). Every several
seconds it crashes with:

fatal error: runtime_lock: lock count
runtime stack:
ERROR: signal: segmentation fault (core dumped)

or:

fatal error: schedule: holding locks
runtime stack:
ERROR: signal: segmentation fault (core dumped)

or:

fatal error: schedule: holding locks
runtime stack:
runtime_dopanic
    ../../../libgo/runtime/panic.c:82
runtime_throw
    ../../../libgo/runtime/panic.c:116
schedule
    ../../../libgo/runtime/proc.c:1720
runtime_mstart
    ../../../libgo/runtime/proc.c:1000
main
    ../../../libgo/runtime/go-main.c:43
goroutine 1 [runnable]:
runtime_mcall
    ../../../libgo/runtime/proc.c:292
runtime_gc
    ../../../libgo/runtime/mgc0.c:2025
runtime_mallocgc
    ../../../libgo/runtime/malloc.goc:201
runtime_makechan_c
    ../../../libgo/runtime/chan.c:112
main.main
    /tmp/lockcount.go:23
runtime_main
    ../../../libgo/runtime/proc.c:562
kickoff
    ../../../libgo/runtime/proc.c:229
goroutine 2 [syscall]:
    goroutine in C code; stack unavailable
created by runtime_main
    ../../../libgo/runtime/proc.c:549
goroutine 3 [runnable]:
runtime_mcall
    ../../../libgo/runtime/proc.c:292
main.$nested0
    /tmp/lockcount.go:12
kickoff
    ../../../libgo/runtime/proc.c:229
created by main.$init0
    /tmp/lockcount.go:9
goroutine 4 [sleep]:
runtime_mcall
    ../../../libgo/runtime/proc.c:292
runtime_tsleep
    ../../../libgo/runtime/time.goc:81
main.$nested1
    /tmp/lockcount.go:16
kickoff
    ../../../libgo/runtime/proc.c:229
created by main.$init0
    /tmp/lockcount.go:15
goroutine 5 [syscall]:
    goroutine in C code; stack unavailable
created by addtimer
    ../../../libgo/runtime/time.goc:131

Reply via email to