• Dmitriy Vyukov's avatar
    runtime: fix specials deadlock · b039abfc
    Dmitriy Vyukov authored
    The deadlock is between span->specialLock and proflock:
    
    goroutine 11 [running]:
    runtime.MProf_Free(0x7fa272d26508, 0xc210054180, 0xc0)
            src/pkg/runtime/mprof.goc:220 +0x27
    runtime.freespecial(0x7fa272d1e088, 0xc210054180, 0xc0)
            src/pkg/runtime/mheap.c:691 +0x6a
    runtime.freeallspecials(0x7fa272d1af50, 0xc210054180, 0xc0)
            src/pkg/runtime/mheap.c:717 +0xb5
    runtime.free(0xc210054180)
            src/pkg/runtime/malloc.goc:190 +0xfd
    selectgo(0x7fa272a5ef58)
            src/pkg/runtime/chan.c:1136 +0x2d8
    runtime.selectgo(0xc210054180)
            src/pkg/runtime/chan.c:840 +0x12
    runtime_test.func·058()
            src/pkg/runtime/proc_test.go:146 +0xb4
    runtime.goexit()
            src/pkg/runtime/proc.c:1405
    created by runtime_test.TestTimerFairness
            src/pkg/runtime/proc_test.go:152 +0xd1
    
    goroutine 12 [running]:
    addspecial(0xc2100540c0, 0x7fa272d1e0a0)
            src/pkg/runtime/mheap.c:569 +0x88
    runtime.setprofilebucket(0xc2100540c0, 0x7fa272d26508)
            src/pkg/runtime/mheap.c:668 +0x73
    runtime.MProf_Malloc(0xc2100540c0, 0xc0, 0x0)
            src/pkg/runtime/mprof.goc:212 +0x16b
    runtime.mallocgc(0xc0, 0x0, 0xc200000000)
            src/pkg/runtime/malloc.goc:142 +0x239
    runtime.mal(0xbc)
            src/pkg/runtime/malloc.goc:703 +0x38
    newselect(0x2, 0x7fa272a5cf60)
            src/pkg/runtime/chan.c:632 +0x53
    runtime.newselect(0xc200000002, 0xc21005f000)
            src/pkg/runtime/chan.c:615 +0x28
    runtime_test.func·058()
            src/pkg/runtime/proc_test.go:146 +0x37
    runtime.goexit()
            src/pkg/runtime/proc.c:1405
    created by runtime_test.TestTimerFairness
            src/pkg/runtime/proc_test.go:152 +0xd1
    
    Fixes #7099.
    
    R=golang-codereviews, khr
    CC=golang-codereviews
    https://golang.org/cl/53120043
    b039abfc
Name
Last commit
Last update
..
cgo Loading commit data...
debug Loading commit data...
pprof Loading commit data...
race Loading commit data...
Makefile Loading commit data...
alg.c Loading commit data...
append_test.go Loading commit data...
arch_386.h Loading commit data...
arch_amd64.h Loading commit data...
arch_arm.h Loading commit data...
asm_386.s Loading commit data...
asm_amd64.s Loading commit data...
asm_arm.s Loading commit data...
atomic_386.c Loading commit data...
atomic_amd64.c Loading commit data...
atomic_arm.c Loading commit data...
callback_windows.c Loading commit data...
cgocall.c Loading commit data...
cgocall.h Loading commit data...
chan.c Loading commit data...
chan_test.go Loading commit data...
closure_test.go Loading commit data...
compiler.go Loading commit data...
complex.c Loading commit data...
complex_test.go Loading commit data...
cpuprof.c Loading commit data...
crash_cgo_test.go Loading commit data...
crash_test.go Loading commit data...
debug.go Loading commit data...
defs1_linux.go Loading commit data...
defs2_linux.go Loading commit data...
defs_arm_linux.go Loading commit data...
defs_darwin.go Loading commit data...
defs_darwin_386.h Loading commit data...
defs_darwin_amd64.h Loading commit data...
defs_dragonfly.go Loading commit data...
defs_dragonfly_386.h Loading commit data...
defs_dragonfly_amd64.h Loading commit data...
defs_freebsd.go Loading commit data...
defs_freebsd_386.h Loading commit data...
defs_freebsd_amd64.h Loading commit data...
defs_freebsd_arm.h Loading commit data...
defs_linux.go Loading commit data...
defs_linux_386.h Loading commit data...
defs_linux_amd64.h Loading commit data...
defs_linux_arm.h Loading commit data...
defs_netbsd.go Loading commit data...
defs_netbsd_386.go Loading commit data...
defs_netbsd_386.h Loading commit data...
defs_netbsd_amd64.go Loading commit data...
defs_netbsd_amd64.h Loading commit data...
defs_netbsd_arm.go Loading commit data...
defs_netbsd_arm.h Loading commit data...
defs_openbsd.go Loading commit data...
defs_openbsd_386.h Loading commit data...
defs_openbsd_amd64.h Loading commit data...
defs_plan9_386.h Loading commit data...
defs_plan9_amd64.h Loading commit data...
defs_solaris.go Loading commit data...
defs_solaris_amd64.go Loading commit data...
defs_solaris_amd64.h Loading commit data...
defs_windows.go Loading commit data...
defs_windows_386.h Loading commit data...
defs_windows_amd64.h Loading commit data...
env_plan9.c Loading commit data...
env_posix.c Loading commit data...
error.go Loading commit data...
export_futex_test.go Loading commit data...
export_test.c Loading commit data...
export_test.go Loading commit data...
extern.go Loading commit data...
float.c Loading commit data...
funcdata.h Loading commit data...
futex_test.go Loading commit data...
gc_test.go Loading commit data...
hash_test.go Loading commit data...
hashmap.c Loading commit data...
hashmap_fast.c Loading commit data...
iface.c Loading commit data...
iface_test.go Loading commit data...
lfstack.c Loading commit data...
lfstack_test.go Loading commit data...
lock_futex.c Loading commit data...
lock_sema.c Loading commit data...
malloc.goc Loading commit data...
malloc.h Loading commit data...
malloc1.go Loading commit data...
malloc_test.go Loading commit data...
mallocrand.go Loading commit data...
mallocrep.go Loading commit data...
mallocrep1.go Loading commit data...
map_test.go Loading commit data...
mapspeed_test.go Loading commit data...
mcache.c Loading commit data...
mcentral.c Loading commit data...
mem.go Loading commit data...
mem_darwin.c Loading commit data...
mem_dragonfly.c Loading commit data...
mem_freebsd.c Loading commit data...
mem_linux.c Loading commit data...
mem_netbsd.c Loading commit data...
mem_openbsd.c Loading commit data...
mem_plan9.c Loading commit data...
mem_solaris.c Loading commit data...
mem_windows.c Loading commit data...
memclr_arm.s Loading commit data...
memmove_386.s Loading commit data...
memmove_amd64.s Loading commit data...
memmove_arm.s Loading commit data...
memmove_linux_amd64_test.go Loading commit data...
memmove_test.go Loading commit data...
mfinal_test.go Loading commit data...
mfixalloc.c Loading commit data...
mgc0.c Loading commit data...
mgc0.go Loading commit data...
mgc0.h Loading commit data...
mheap.c Loading commit data...
mprof.goc Loading commit data...
msize.c Loading commit data...
netpoll.goc Loading commit data...
netpoll_epoll.c Loading commit data...
netpoll_kqueue.c Loading commit data...
netpoll_stub.c Loading commit data...
netpoll_windows.c Loading commit data...
noasm_arm.goc Loading commit data...
norace_test.go Loading commit data...
os_darwin.c Loading commit data...
os_darwin.h Loading commit data...
os_dragonfly.c Loading commit data...
os_dragonfly.h Loading commit data...
os_freebsd.c Loading commit data...
os_freebsd.h Loading commit data...
os_freebsd_arm.c Loading commit data...
os_linux.c Loading commit data...
os_linux.h Loading commit data...
os_linux_386.c Loading commit data...
os_linux_arm.c Loading commit data...
os_netbsd.c Loading commit data...
os_netbsd.h Loading commit data...
os_netbsd_386.c Loading commit data...
os_netbsd_amd64.c Loading commit data...
os_netbsd_arm.c Loading commit data...
os_openbsd.c Loading commit data...
os_openbsd.h Loading commit data...
os_plan9.c Loading commit data...
os_plan9.h Loading commit data...
os_plan9_386.c Loading commit data...
os_plan9_amd64.c Loading commit data...
os_solaris.c Loading commit data...
os_solaris.h Loading commit data...
os_windows.c Loading commit data...
os_windows.h Loading commit data...
os_windows_386.c Loading commit data...
os_windows_amd64.c Loading commit data...
panic.c Loading commit data...
parfor.c Loading commit data...
parfor_test.go Loading commit data...
print.c Loading commit data...
proc.c Loading commit data...
proc.p Loading commit data...
proc_test.go Loading commit data...
race.c Loading commit data...
race.go Loading commit data...
race.h Loading commit data...
race0.c Loading commit data...
race_amd64.s Loading commit data...
rt0_darwin_386.s Loading commit data...
rt0_darwin_amd64.s Loading commit data...
rt0_dragonfly_386.s Loading commit data...
rt0_dragonfly_amd64.s Loading commit data...
rt0_freebsd_386.s Loading commit data...
rt0_freebsd_amd64.s Loading commit data...
rt0_freebsd_arm.s Loading commit data...
rt0_linux_386.s Loading commit data...
rt0_linux_amd64.s Loading commit data...
rt0_linux_arm.s Loading commit data...
rt0_netbsd_386.s Loading commit data...
rt0_netbsd_amd64.s Loading commit data...
rt0_netbsd_arm.s Loading commit data...
rt0_openbsd_386.s Loading commit data...
rt0_openbsd_amd64.s Loading commit data...
rt0_plan9_386.s Loading commit data...
rt0_plan9_amd64.s Loading commit data...
rt0_solaris_amd64.s Loading commit data...
rt0_windows_386.s Loading commit data...
rt0_windows_amd64.s Loading commit data...
rune.c Loading commit data...
runtime-gdb.py Loading commit data...
runtime.c Loading commit data...
runtime.h Loading commit data...
runtime1.goc Loading commit data...
runtime_linux_test.go Loading commit data...
runtime_test.go Loading commit data...
runtime_unix_test.go Loading commit data...
sema.goc Loading commit data...
signal_386.c Loading commit data...
signal_amd64.c Loading commit data...
signal_arm.c Loading commit data...
signal_darwin_386.h Loading commit data...
signal_darwin_amd64.h Loading commit data...
signal_dragonfly_386.h Loading commit data...
signal_dragonfly_amd64.h Loading commit data...
signal_freebsd_386.h Loading commit data...
signal_freebsd_amd64.h Loading commit data...
signal_freebsd_arm.h Loading commit data...
signal_linux_386.h Loading commit data...
signal_linux_amd64.h Loading commit data...
signal_linux_arm.h Loading commit data...
signal_netbsd_386.h Loading commit data...
signal_netbsd_amd64.h Loading commit data...
signal_netbsd_arm.h Loading commit data...
signal_openbsd_386.h Loading commit data...
signal_openbsd_amd64.h Loading commit data...
signal_solaris_amd64.h Loading commit data...
signal_unix.c Loading commit data...
signal_unix.h Loading commit data...
signals_darwin.h Loading commit data...
signals_dragonfly.h Loading commit data...
signals_freebsd.h Loading commit data...
signals_linux.h Loading commit data...
signals_netbsd.h Loading commit data...
signals_openbsd.h Loading commit data...
signals_plan9.h Loading commit data...
signals_solaris.h Loading commit data...
signals_windows.h Loading commit data...
sigqueue.goc Loading commit data...
slice.c Loading commit data...
softfloat64.go Loading commit data...
softfloat64_test.go Loading commit data...
softfloat_arm.c Loading commit data...
stack.c Loading commit data...
stack.h Loading commit data...
stack_test.go Loading commit data...
string.goc Loading commit data...
string_test.go Loading commit data...
symtab.c Loading commit data...
symtab_test.go Loading commit data...
sys_arm.c Loading commit data...
sys_darwin_386.s Loading commit data...
sys_darwin_amd64.s Loading commit data...
sys_dragonfly_386.s Loading commit data...
sys_dragonfly_amd64.s Loading commit data...
sys_freebsd_386.s Loading commit data...
sys_freebsd_amd64.s Loading commit data...
sys_freebsd_arm.s Loading commit data...
sys_linux_386.s Loading commit data...
sys_linux_amd64.s Loading commit data...
sys_linux_arm.s Loading commit data...
sys_netbsd_386.s Loading commit data...
sys_netbsd_amd64.s Loading commit data...
sys_netbsd_arm.s Loading commit data...
sys_openbsd_386.s Loading commit data...
sys_openbsd_amd64.s Loading commit data...
sys_plan9_386.s Loading commit data...
sys_plan9_amd64.s Loading commit data...
sys_solaris_amd64.s Loading commit data...
sys_windows_386.s Loading commit data...
sys_windows_amd64.s Loading commit data...
sys_x86.c Loading commit data...
syscall_solaris.goc Loading commit data...
syscall_windows.goc Loading commit data...
syscall_windows_test.go Loading commit data...
time.goc Loading commit data...
time_plan9_386.c Loading commit data...
traceback_arm.c Loading commit data...
traceback_x86.c Loading commit data...
type.go Loading commit data...
type.h Loading commit data...
typekind.h Loading commit data...
vdso_linux_amd64.c Loading commit data...
vlop_386.s Loading commit data...
vlop_arm.s Loading commit data...
vlop_arm_test.go Loading commit data...
vlrt_386.c Loading commit data...
vlrt_arm.c Loading commit data...