• Dmitriy Vyukov's avatar
    runtime: don't lock mheap on user goroutine · e91704af
    Dmitriy Vyukov authored
    This is bad for 2 reasons:
    1. if the code under lock ever grows stack,
    it will deadlock as stack growing acquires mheap lock.
    2. It currently deadlocks with SetCPUProfileRate:
    scavenger locks mheap, receives prof signal and tries to lock prof lock;
    meanwhile SetCPUProfileRate locks prof lock and tries to grow stack
    (presumably in runtime.unlock->futexwakeup). Boom.
    Let's assume that it
    Fixes #8407.
    
    LGTM=rsc
    R=golang-codereviews, rsc
    CC=golang-codereviews, khr
    https://golang.org/cl/112640043
    e91704af
mheap.c 25.4 KB