Closed
Description
runtime: gc crash in tests We're seeing some crashes in the garbage collector while running runtime tests on a particular Solaris machine, for example: http://build.golang.org/log/f80b1657689632e2f02fd3976f6b15edc4d130a6 http://build.golang.org/log/09d748b886fe7e70d34f6e4bf58561a3ea5871b1 The machine exposes 24 CPUs but has little memory. On another machine with 24 CPUs but with more memory I can still see the failures, but much more rarely. On my 4 CPU machine I never see the failures. If I disable the GC, the failure goes away. This is possibly related to issue #7502 and issue #7159 (the crash seems to occur only in tests that use reflection). It happens in various tests, but it always fails in the same place. SIGSEGV: segmentation violation PC=0x409620 goroutine 0 [idle]: scanblock(0x0, 0x1) /home/aram/go/src/pkg/runtime/mgc0.c:1023 +0xc80 runtime.gchelper() /home/aram/go/src/pkg/runtime/mgc0.c:2044 +0x45 stopm() /home/aram/go/src/pkg/runtime/proc.c:960 +0x111 gcstopm() /home/aram/go/src/pkg/runtime/proc.c:1125 +0xc4 schedule() /home/aram/go/src/pkg/runtime/proc.c:1322 +0x4a runtime.gosched0(0xc208044480) /home/aram/go/src/pkg/runtime/proc.c:1437 +0x9e runtime.newstack() /home/aram/go/src/pkg/runtime/stack.c:657 +0x330 runtime.morestack() /home/aram/go/src/pkg/runtime/asm_amd64.s:228 +0x6a The code in scanblock is: case GC_DEFAULT_PTR: while(stack_top.b <= end_b) { obj = *(byte**)stack_top.b; >>> stack_top.b += PtrSize; if(obj >= arena_start && obj < arena_used) { *sbuf.ptr.pos++ = (PtrTarget){obj, 0}; if(sbuf.ptr.pos == sbuf.ptr.end) flushptrbuf(&sbuf); } } goto next_block; I have confirmed in the debugger that stack_top.b is zero. Other frames related to the GC are: goroutine 18 [GC sweep wait]: runtime.park(0x415bf0, 0x856d68, 0x8534ac) /home/aram/go/src/pkg/runtime/proc.c:1370 +0x89 runtime.parkunlock(0x856d68, 0x8534ac) /home/aram/go/src/pkg/runtime/proc.c:1386 +0x3b bgsweep() /home/aram/go/src/pkg/runtime/mgc0.c:1918 +0xb2 runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime.gc /home/aram/go/src/pkg/runtime/mgc0.c:2187 goroutine 388 [finalizer wait]: runtime.park(0x415bf0, 0x856d68, 0x853692) /home/aram/go/src/pkg/runtime/proc.c:1370 +0x89 runtime.parkunlock(0x856d68, 0x853692) /home/aram/go/src/pkg/runtime/proc.c:1386 +0x3b runfinq() /home/aram/go/src/pkg/runtime/mgc0.c:2555 +0xc2 runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime.gc /home/aram/go/src/pkg/runtime/mgc0.c:2187 goroutine 52392 [garbage collection]: runtime.gc(0xfffffd7f00000000) /home/aram/go/src/pkg/runtime/mgc0.c:2250 +0x1b2 runtime.mallocgc(0x20, 0x673820, 0x0) /home/aram/go/src/pkg/runtime/malloc.goc:206 +0x1b7 runtime.new(0x673820, 0x8) /home/aram/go/src/pkg/runtime/malloc.goc:815 +0x32 reflect.Value.MapIndex(0x5f5a20, 0xc208108060, 0x0, 0x150, 0x5f7560, ...) /home/aram/go/src/pkg/reflect/value.go:1165 +0x45 runtime_test.func·044() /home/aram/go/src/pkg/runtime/map_test.go:272 +0x15d runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime_test.testConcurrentReadsAfterGrowth /home/aram/go/src/pkg/runtime/map_test.go:274 +0x26a And frames related to reflection: goroutine 52398 [semacquire]: runtime.park(0x415bf0, 0x864b00, 0x84fac0) /home/aram/go/src/pkg/runtime/proc.c:1370 +0x89 runtime.parkunlock(0x864b00, 0x84fac0) /home/aram/go/src/pkg/runtime/proc.c:1386 +0x3b runtime.semacquire(0x849294, 0x0) /home/aram/go/src/pkg/runtime/sema.goc:140 +0x10e runtime.gc(0xfffffd7f00000000) /home/aram/go/src/pkg/runtime/mgc0.c:2220 +0xfc runtime.mallocgc(0x20, 0x673820, 0x0) /home/aram/go/src/pkg/runtime/malloc.goc:206 +0x1b7 runtime.new(0x673820, 0x8) /home/aram/go/src/pkg/runtime/malloc.goc:815 +0x32 reflect.Value.MapIndex(0x5f5a20, 0xc208108060, 0x0, 0x150, 0x5f7560, ...) /home/aram/go/src/pkg/reflect/value.go:1165 +0x45 runtime_test.func·044() /home/aram/go/src/pkg/runtime/map_test.go:272 +0x15d runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime_test.testConcurrentReadsAfterGrowth /home/aram/go/src/pkg/runtime/map_test.go:274 +0x26a goroutine 52914 [runnable]: reflect.loadScalar(0xc208142e38, 0x8, 0xf2) /home/aram/go/src/pkg/reflect/value.go:223 reflect.Value.MapKeys(0x5f5a20, 0xc208108060, 0x0, 0x150, 0x0, ...) /home/aram/go/src/pkg/reflect/value.go:1242 +0x343 runtime_test.func·044() /home/aram/go/src/pkg/runtime/map_test.go:270 +0xc3 runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime_test.testConcurrentReadsAfterGrowth /home/aram/go/src/pkg/runtime/map_test.go:274 +0x26a goroutine 52890 [runnable]: reflect.mapiternext(0xc20810e190) /home/aram/go/src/pkg/runtime/hashmap.goc:1046 reflect.Value.MapKeys(0x5f5a20, 0xc208108060, 0x0, 0x150, 0x0, ...) /home/aram/go/src/pkg/reflect/value.go:1244 +0x29c runtime_test.func·044() /home/aram/go/src/pkg/runtime/map_test.go:270 +0xc3 runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime_test.testConcurrentReadsAfterGrowth /home/aram/go/src/pkg/runtime/map_test.go:274 +0x26a goroutine 52395 [runnable]: reflect.mapiternext(0xc20824c230) /home/aram/go/src/pkg/runtime/hashmap.goc:1046 reflect.Value.MapKeys(0x5f5a20, 0xc208108060, 0x0, 0x150, 0x0, ...) /home/aram/go/src/pkg/reflect/value.go:1244 +0x29c runtime_test.func·044() /home/aram/go/src/pkg/runtime/map_test.go:270 +0xc3 runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime_test.testConcurrentReadsAfterGrowth /home/aram/go/src/pkg/runtime/map_test.go:274 +0x26a goroutine 52917 [runnable]: reflect.loadScalar(0xc20826fb30, 0x8, 0x143) /home/aram/go/src/pkg/reflect/value.go:223 reflect.Value.MapKeys(0x5f5a20, 0xc208108060, 0x0, 0x150, 0x0, ...) /home/aram/go/src/pkg/reflect/value.go:1242 +0x343 runtime_test.func·044() /home/aram/go/src/pkg/runtime/map_test.go:270 +0xc3 runtime.goexit() /home/aram/go/src/pkg/runtime/proc.c:1446 created by runtime_test.testConcurrentReadsAfterGrowth /home/aram/go/src/pkg/runtime/map_test.go:274 +0x26a Full stack trace can be found in the referenced build logs.