#Debugging test/synctest goroutine panics - any tips?

3 messages · Page 1 of 1 (latest)

low leaf
#

This is what my traceback looks like:

➜  remote git:(0130a55b) ✗ go test primarysleeper_test.go cluster.go expr.go
fatal error: close of synctest channel from outside bubble

goroutine 28 [running]:
context.(*cancelCtx).cancel(0xc0004aa3c0, 0x1, {0x129f260, 0x1ae3eb0}, {0x0?, 0x0?})
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/context/context.go:567 +0x1d4
context.WithCancel.func1()
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/context/context.go:242 +0x2f
testing.(*common).runCleanup(0xc000517180, 0xc00050c158?)
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:1557 +0xd6
testing.tRunner.func2()
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:1928 +0x25
testing.tRunner(0xc000517180, 0x11874b8)
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:1940 +0x114
created by testing.(*T).Run in goroutine 1
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:1997 +0x465

goroutine 1 [chan receive]:
testing.(*T).Run(0xc0005168c0, {0x1140010?, 0xc000387b30?}, 0x11874b8)
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:2005 +0x485
testing.runTests.func1(0xc0005168c0)
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:2477 +0x37
testing.tRunner(0xc0005168c0, 0xc000387c70)
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:1934 +0xea
testing.runTests(0xc0004a2000, {0x1b06500, 0xb, 0xb}, {0x7?, 0xc0004b6800?, 0x1b19f20?})
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:2475 +0x4b4
testing.(*M).Run(0xc0005c4000)
    /home/me/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.25.3.linux-amd64/src/testing/testing.go:2337 +0x63a
main.main()
    _testmain.go:65 +0x9b
FAIL    command-line-arguments    0.013s
FAIL

note that none of the lines reference the code that i'm working on directly. is there an easy way to get additional context about where those goroutines come from, or where the cancel() invocation was that caused this problem?

low leaf
#

i ended up finding the issue, which was that i needed to get a handle on t.Context() from within the bubble rather than without

#

but nothing about the tracebacks helped with this 🤔