go: runtime: frequent TestCrashDumpsAllThreads failures on `linux/s390x`

#!watchflakes
post <- goarch == "s390x" && pkg == "runtime" && test == "TestCrashDumpsAllThreads"

Go version

ca804118b1ff4ea6cd0b83808e140671d7e10f6f

What operating system and processor architecture are you using (go env)?

linux-s390x-ibm-race at ca804118b1ff4ea6cd0b83808e140671d7e10f6f

:: Running /data/golang/workdir/go/src/make.bash with args ["/data/golang/workdir/go/src/make.bash" "-force"] and env ["LANG=en_US.UTF-8" "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" "HOME=/root" "LOGNAME=root" "USER=root" "SHELL=/bin/sh" "INVOCATION_ID=5ad2b81f504d4d4493366f364d13f297" "JOURNAL_STREAM=9:358624446" "META_BUILDLET_BINARY_URL=https://storage.googleapis.com/go-builder-data/buildlet.linux-s390x" "GO_STAGE0_NET_DELAY=0s" "GO_STAGE0_DL_DELAY=100ms" "WORKDIR=/data/golang/workdir" "GOROOT_BOOTSTRAP=/data/golang/workdir/go1.4" "GO_BUILDER_NAME=linux-s390x-ibm-race" "GO_BUILDER_FLAKY_NET=1" "GO_TEST_TIMEOUT_SCALE=5" "GOBIN=" "TMPDIR=/data/golang/workdir/tmp" "GOCACHE=/data/golang/workdir/gocache" "GOPLSCACHE=/data/golang/workdir/goplscache" "PWD=/data/golang/workdir/go/src"] in dir /data/golang/workdir/go/src

What did you do?

https://build.golang.org/log/5e29be06bbb7a8a4923d83a58972aa2a10677a94

What did you expect to see?

All tests passing.

What did you see instead?

--- FAIL: TestCrashDumpsAllThreads (0.11s)
    crash_unix_test.go:145: found 2 instances of main.crashDumpsAllThreadsLoop; expected 4
…
FAIL
FAIL	runtime	46.511s

(attn @golang/s390x)

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 182 (181 by maintainers)

Commits related to this issue

Most upvoted comments

@mknyszek @bcmills We had a look at this issue and we used git bisect to figure out the culprit commit.

Bad Commit Id: de5b418b which introducing failure of TestCrashDumpsAllThreads() We had a look at the file changes corresponding to the bad commit, we see that there are some changes to signal_unix.go file and we suspect that issue lies with the changes made to this file. We are further having look at the changes and we will update when we find more about the root cause of the failure.

@bcmills Am I understanding correctly that you are saying that ultimately the test is failing because traceback reports goroutine running on other thread; stack unavailable for the running threads? If so, I think that is a misunderstanding. That report is expected and appears even when the test passes (attached below). Part of the purpose of sending SIGQUIT to every thread so we can report the stacks even of threads that are spinning in user code; this test tries to ensure that we reach every thread.


Passing test output:

=== RUN   TestCrashDumpsAllThreads
    crash_test.go:152: running /usr/local/google/home/mpratt/src/go/bin/go build -o /tmp/go-build171157893/testprog.exe
    crash_test.go:158: built testprog in 243.153612ms
    crash_unix_test.go:143: SIGQUIT: quit
        PC=0x4c4709 m=0 sigcode=0
        
        goroutine 21 gp=0xc000082a80 m=0 mp=0x5d1000 [running]:
        main.crashDumpsAllThreadsLoop(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:44
        main.CrashDumpsAllThreads.gowrap1()
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x29 fp=0xc000053fe0 sp=0xc000053fc8 pc=0x4c4709
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000053fe8 sp=0xc000053fe0 pc=0x46aaa1
        created by main.CrashDumpsAllThreads in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x3e
        
        goroutine 1 gp=0xc0000081c0 m=nil [select (no cases)]:
        runtime.gopark(0x1?, 0x0?, 0x0?, 0x0?, 0x0?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:402 +0xce fp=0xc00009adf8 sp=0xc00009add8 pc=0x43b0ce
        runtime.block()
        	/usr/local/google/home/mpratt/src/go/src/runtime/select.go:103 +0x26 fp=0xc00009ae28 sp=0xc00009adf8 pc=0x44c1c6
        main.CrashDumpsAllThreads()
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:38 +0x16a fp=0xc00009aeb8 sp=0xc00009ae28 pc=0x4c46ca
        main.main()
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/main.go:34 +0x133 fp=0xc00009af50 sp=0xc00009aeb8 pc=0x4c9773
        runtime.main()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:271 +0x29d fp=0xc00009afe0 sp=0xc00009af50 pc=0x43ac9d
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc00009afe8 sp=0xc00009afe0 pc=0x46aaa1
        
        goroutine 2 gp=0xc000008700 m=nil [force gc (idle)]:
        runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:402 +0xce fp=0xc000056fa8 sp=0xc000056f88 pc=0x43b0ce
        runtime.goparkunlock(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:408
        runtime.forcegchelper()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:326 +0xb3 fp=0xc000056fe0 sp=0xc000056fa8 pc=0x43af53
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000056fe8 sp=0xc000056fe0 pc=0x46aaa1
        created by runtime.init.6 in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:314 +0x1a
        
        goroutine 3 gp=0xc000008c40 m=nil [GC sweep wait]:
        runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:402 +0xce fp=0xc000057780 sp=0xc000057760 pc=0x43b0ce
        runtime.goparkunlock(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:408
        runtime.bgsweep(0xc000020070)
        	/usr/local/google/home/mpratt/src/go/src/runtime/mgcsweep.go:277 +0x94 fp=0xc0000577c8 sp=0xc000057780 pc=0x425b14
        runtime.gcenable.gowrap1()
        	/usr/local/google/home/mpratt/src/go/src/runtime/mgc.go:203 +0x25 fp=0xc0000577e0 sp=0xc0000577c8 pc=0x41a305
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000577e8 sp=0xc0000577e0 pc=0x46aaa1
        created by runtime.gcenable in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/mgc.go:203 +0x66
        
        goroutine 4 gp=0xc000008e00 m=nil [GC scavenge wait]:
        runtime.gopark(0xc000020070?, 0x526eb8?, 0x1?, 0x0?, 0xc000008e00?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:402 +0xce fp=0xc000057f78 sp=0xc000057f58 pc=0x43b0ce
        runtime.goparkunlock(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:408
        runtime.(*scavengerState).park(0x5d09a0)
        	/usr/local/google/home/mpratt/src/go/src/runtime/mgcscavenge.go:425 +0x49 fp=0xc000057fa8 sp=0xc000057f78 pc=0x423509
        runtime.bgscavenge(0xc000020070)
        	/usr/local/google/home/mpratt/src/go/src/runtime/mgcscavenge.go:653 +0x3c fp=0xc000057fc8 sp=0xc000057fa8 pc=0x423a9c
        runtime.gcenable.gowrap2()
        	/usr/local/google/home/mpratt/src/go/src/runtime/mgc.go:204 +0x25 fp=0xc000057fe0 sp=0xc000057fc8 pc=0x41a2a5
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000057fe8 sp=0xc000057fe0 pc=0x46aaa1
        created by runtime.gcenable in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/mgc.go:204 +0xa5
        
        goroutine 17 gp=0xc000082380 m=nil [finalizer wait]:
        runtime.gopark(0xc000056660?, 0x42287c?, 0x0?, 0xb?, 0x550011?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:402 +0xce fp=0xc000056620 sp=0xc000056600 pc=0x43b0ce
        runtime.runfinq()
        	/usr/local/google/home/mpratt/src/go/src/runtime/mfinal.go:194 +0x107 fp=0xc0000567e0 sp=0xc000056620 pc=0x419347
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000567e8 sp=0xc0000567e0 pc=0x46aaa1
        created by runtime.createfing in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/mfinal.go:164 +0x3d
        
        goroutine 18 gp=0xc000082540 m=4 mp=0xc000080008 [running]:
        	goroutine running on other thread; stack unavailable
        created by main.CrashDumpsAllThreads in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x3e
        
        goroutine 19 gp=0xc000082700 m=3 mp=0xc00005d008 [running]:
        	goroutine running on other thread; stack unavailable
        created by main.CrashDumpsAllThreads in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x3e
        
        goroutine 20 gp=0xc0000828c0 m=2 mp=0xc00005c808 [running]:
        	goroutine running on other thread; stack unavailable
        created by main.CrashDumpsAllThreads in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x3e
        
        rax    0xce933
        rbx    0xc000094238
        rcx    0xc000082a80
        rdx    0x0
        rdi    0x1
        rsi    0x1
        rbp    0xc000053fd0
        rsp    0xc000053fc8
        r8     0xc000008101
        r9     0x2
        r10    0x7f846888faa8
        r11    0x53ffe0
        r12    0x0
        r13    0x0
        r14    0xc000082a80
        r15    0x0
        rip    0x4c4709
        rflags 0x293
        cs     0x33
        fs     0x0
        gs     0x0
        
        -----
        
        SIGQUIT: quit
        PC=0x46c8a3 m=1 sigcode=0
        
        goroutine 0 gp=0xc000008540 m=1 mp=0xc00005c008 [idle]:
        runtime.futex(0x5d1900, 0x80, 0x0, 0xc00002feb8, 0x0, 0x0)
        	/usr/local/google/home/mpratt/src/go/src/runtime/sys_linux_amd64.s:558 +0x23 fp=0xc00002fe88 sp=0xc00002fe80 pc=0x46c8a3
        runtime.futexsleep(0x27cfa6f45807e?, 0x2ff08?, 0x40c7d0?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/os_linux.go:75 +0xa5 fp=0xc00002fed8 sp=0xc00002fe88 pc=0x434c85
        runtime.notetsleep_internal(0x5d1900, 0xdf8475800)
        	/usr/local/google/home/mpratt/src/go/src/runtime/lock_futex.go:212 +0xb3 fp=0xc00002ff18 sp=0xc00002fed8 pc=0x40ca93
        runtime.notetsleep(0x27cfa6f457ec2?, 0xc000000002?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/lock_futex.go:235 +0x29 fp=0xc00002ff38 sp=0xc00002ff18 pc=0x40cbc9
        runtime.sysmon()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:5994 +0x1c6 fp=0xc00002ffa0 sp=0xc00002ff38 pc=0x447586
        runtime.mstart1()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:1729 +0x93 fp=0xc00002ffc8 sp=0xc00002ffa0 pc=0x43de73
        runtime.mstart0()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:1686 +0x76 fp=0xc00002fff8 sp=0xc00002ffc8 pc=0x43ddb6
        runtime.mstart()
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:394 +0x5 fp=0xc000030000 sp=0xc00002fff8 pc=0x468b65
        rax    0xfffffffffffffffc
        rbx    0x0
        rcx    0x46c8a3
        rdx    0x0
        rdi    0x5d1900
        rsi    0x80
        rbp    0xc00002fec8
        rsp    0xc00002fe80
        r8     0x0
        r9     0x0
        r10    0xc00002feb8
        r11    0x246
        r12    0xc00002feb8
        r13    0xc00005c008
        r14    0xc000008540
        r15    0xfffffffffffffff
        rip    0x46c8a3
        rflags 0x246
        cs     0x33
        fs     0x0
        gs     0x0
        
        -----
        
        SIGQUIT: quit
        PC=0x4c4709 m=2 sigcode=0
        
        goroutine 20 gp=0xc0000828c0 m=2 mp=0xc00005c808 [running]:
        main.crashDumpsAllThreadsLoop(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:44
        main.CrashDumpsAllThreads.gowrap1()
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x29 fp=0xc0000537e0 sp=0xc0000537c8 pc=0x4c4709
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000537e8 sp=0xc0000537e0 pc=0x46aaa1
        created by main.CrashDumpsAllThreads in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x3e
        rax    0xbce0f5
        rbx    0xc0000941d8
        rcx    0xc0000828c0
        rdx    0x0
        rdi    0x1
        rsi    0xc00003cf08
        rbp    0xc0000537d0
        rsp    0xc0000537c8
        r8     0xc000100001
        r9     0xc0001021c0
        r10    0x8
        r11    0x216
        r12    0x0
        r13    0xc000100008
        r14    0xc0000828c0
        r15    0x3fffffffffffffff
        rip    0x4c4709
        rflags 0x297
        cs     0x33
        fs     0x0
        gs     0x0
        
        -----
        
        SIGQUIT: quit
        PC=0x4c4709 m=3 sigcode=0
        
        goroutine 19 gp=0xc000082700 m=3 mp=0xc00005d008 [running]:
        main.crashDumpsAllThreadsLoop(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:44
        main.CrashDumpsAllThreads.gowrap1()
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x29 fp=0xc000052fe0 sp=0xc000052fc8 pc=0x4c4709
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc000052fe8 sp=0xc000052fe0 pc=0x46aaa1
        created by main.CrashDumpsAllThreads in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x3e
        rax    0x1234d46
        rbx    0xc000094178
        rcx    0xc000082700
        rdx    0x0
        rdi    0x1
        rsi    0xc000036008
        rbp    0xc000052fd0
        rsp    0xc000052fc8
        r8     0x1
        r9     0x0
        r10    0x0
        r11    0x202
        r12    0x0
        r13    0x0
        r14    0xc000082700
        r15    0x2
        rip    0x4c4709
        rflags 0x297
        cs     0x33
        fs     0x0
        gs     0x0
        
        -----
        
        SIGQUIT: quit
        PC=0x4c4709 m=4 sigcode=0
        
        goroutine 18 gp=0xc000082540 m=4 mp=0xc000080008 [running]:
        main.crashDumpsAllThreadsLoop(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:44
        main.CrashDumpsAllThreads.gowrap1()
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x29 fp=0xc0000527e0 sp=0xc0000527c8 pc=0x4c4709
        runtime.goexit({})
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:1695 +0x1 fp=0xc0000527e8 sp=0xc0000527e0 pc=0x46aaa1
        created by main.CrashDumpsAllThreads in goroutine 1
        	/usr/local/google/home/mpratt/src/go/src/runtime/testdata/testprog/crashdump.go:24 +0x3e
        rax    0xdb3206
        rbx    0xc000080008
        rcx    0x1
        rdx    0xc000080008
        rdi    0x0
        rsi    0x1
        rbp    0xc0000527d0
        rsp    0xc0000527c8
        r8     0x1
        r9     0x0
        r10    0xc000093ec0
        r11    0x7ffd5fd52080
        r12    0xc000093ed8
        r13    0x0
        r14    0xc000082540
        r15    0x3
        rip    0x4c4709
        rflags 0x293
        cs     0x33
        fs     0x0
        gs     0x0
        
        -----
        
        SIGQUIT: quit
        PC=0x46c8a1 m=5 sigcode=0
        
        goroutine 0 gp=0xc0001021c0 m=5 mp=0xc000100008 [idle]:
        runtime.futex(0xc000100148, 0x80, 0x0, 0x0, 0x0, 0x0)
        	/usr/local/google/home/mpratt/src/go/src/runtime/sys_linux_amd64.s:557 +0x21 fp=0xc00008fd00 sp=0xc00008fcf8 pc=0x46c8a1
        runtime.futexsleep(0xc00008fd78?, 0x40c7d0?, 0x448867?)
        	/usr/local/google/home/mpratt/src/go/src/runtime/os_linux.go:69 +0x30 fp=0xc00008fd50 sp=0xc00008fd00 pc=0x434c10
        runtime.notesleep(0xc000100148)
        	/usr/local/google/home/mpratt/src/go/src/runtime/lock_futex.go:170 +0x87 fp=0xc00008fd88 sp=0xc00008fd50 pc=0x40c967
        runtime.mPark(...)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:1761
        runtime.stopm()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:2782 +0x8c fp=0xc00008fdb8 sp=0xc00008fd88 pc=0x43f6cc
        runtime.findRunnable()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:3512 +0xd5f fp=0xc00008ff30 sp=0xc00008fdb8 pc=0x44123f
        runtime.schedule()
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:3868 +0xb1 fp=0xc00008ff68 sp=0xc00008ff30 pc=0x442311
        runtime.park_m(0xc0000081c0)
        	/usr/local/google/home/mpratt/src/go/src/runtime/proc.go:4036 +0x1ec fp=0xc00008ffc0 sp=0xc00008ff68 pc=0x4428ec
        runtime.mcall()
        	/usr/local/google/home/mpratt/src/go/src/runtime/asm_amd64.s:458 +0x4e fp=0xc00008ffd8 sp=0xc00008ffc0 pc=0x468bee
        rax    0xca
        rbx    0x0
        rcx    0x46c8a3
        rdx    0x0
        rdi    0xc000100148
        rsi    0x80
        rbp    0xc00008fd40
        rsp    0xc00008fcf8
        r8     0x0
        r9     0x0
        r10    0x0
        r11    0x286
        r12    0x0
        r13    0x1
        r14    0xc0001021c0
        r15    0x3
        rip    0x46c8a1
        rflags 0x286
        cs     0x33
        fs     0x0
        gs     0x0
--- PASS: TestCrashDumpsAllThreads (0.77s)
PASS
ok  	runtime	0.818s

My guess is that maybe it needs more time to receive and handle the SIGQUIT on slow machine? In the former case, if the last one is ready to crash, the others may had already in sleep state. In the latter case, however, they may just increase the crashing and even have no time to print out the SIGQUIT and PC… while the first thread is started to crash?

sighandler should not be re-raising SIGQUIT until after it has already dumped the backtrace for the current thread.

The pattern in the recent watchflakes reports for this issue is that one thread is reported in crashDumpsAllThreadsLoop, and three others (presumably the other crashDumpsAllThreadsLoop threads) are reported as goroutine running on other thread; stack unavailable.

That is, sighandler successfully received the signal and ran, but the crash thread’s call to tracebackothers failed to print stacks for those other goroutines. That happens here: https://cs.opensource.google/go/go/+/master:src/runtime/traceback.go;l=1255-1258;drc=a9c9cc07ac0d3dc73865a57e6ce45c22ada3b5c9

If this is easily reproducible, something to try is to see whether either the crash thread or non-crash threads are hitting the timeouts defined in https://cs.opensource.google/go/go/+/master:src/runtime/signal_unix.go;l=777-785;drc=1ae729e6d34040a84da8ef2fc0b9781efe9b0d95 (i.e., sleeping for 5s total). We don’t want that in the normal case. The normal case should be crashing.Loading() incrementing enough to exit the loop.

@prattmic Thanks. Just take a look on several test failures here, seems none of them exceed 5s(if test time is working correctly). Before this change, usually the last thread which received SIGQUIT will attempt to crash the process, and the others will sleep 5s. After that, the first crash thread will periodically check and crash the process if crashing.Load() > mcount()-int32(extraMLength.Load()). My guess is that maybe it needs more time to receive and handle the SIGQUIT on slow machine? In the former case, if the last one is ready to crash, the others may had already in sleep state. In the latter case, however, they may just increase the crashing and even have no time to print out the SIGQUIT and PC… while the first thread is started to crash?

--- FAIL: TestCrashDumpsAllThreads (0.52s)
--- FAIL: TestCrashDumpsAllThreads (3.04s)
--- FAIL: TestCrashDumpsAllThreads (0.11s)
--- FAIL: TestCrashDumpsAllThreads (0.36s)
--- FAIL: TestCrashDumpsAllThreads (0.48s)
--- FAIL: TestCrashDumpsAllThreads (1.24s)

Since this seems to be very specific to the builder, in triage we’re wondering if anyone from @golang/s390x could start taking a look. It seems to be failing often enough that bisection should identify the culprit, and then that might just reveal the issue.