encore test with `-race` flag set results in a segfault (Go)
Author: HectorMalotCreated May 27, 2025Updated May 6, 2026
when running encore test -race -v -run ^TestWorld$ encore.app/hello this will result in a segfault.
I've reproduced this on the starter hello world repository (no changes) by just running the command as shown above. It consistently results in a segfault. I think this is related to encore and not the test code because I can consistently reproduce it even in the templates.
Relevant details
Machine: MacBook (M series) Encore versions tested: 1.48.1 and 1.47.0
Trace
encore test -race -v -run ^TestWorld$ encore.app/hello
encore: daemon is running an outdated version (v1.47.0), restarting.
=== RUN TestWorld
SIGSEGV: segmentation violation
PC=0x10282c23c m=0 sigcode=2 addr=0x10
goroutine 0 gp=0x10372c280 m=0 mp=0x10372d100 [idle]:
goroutine 7 gp=0xc000003c00 m=0 mp=0x10372d100 [running]:
runtime.systemstack_switch()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:201 +0x8 fp=0xc000094910 sp=0xc000094900 pc=0x1028ecbb8
runtime.newproc(0xc0002341e8?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:5028 +0x40 fp=0xc000094950 sp=0xc000094910 pc=0x1028b9c00
encore.dev/appruntime/shared/reqtrack.(*lazyTraceInit).Logger.(*lazyTraceInit).initStream.func1()
/opt/homebrew/Cellar/encore/1.48.1/libexec/runtimes/go/appruntime/shared/reqtrack/trace_stream.go:58 +0xa0 fp=0xc000094990 sp=0xc000094950 pc=0x102f366f0
sync.(*Once).doSlow(0xc0002341d8, 0xc000094a98)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/sync/once.go:78 +0xb0 fp=0xc000094a40 sp=0xc000094990 pc=0x1028fcdc0
sync.(*Once).Do(0xc0002341d8, 0xc000094a98)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/sync/once.go:69 +0x44 fp=0xc000094a60 sp=0xc000094a40 pc=0x1028fcce4
encore.dev/appruntime/shared/reqtrack.(*lazyTraceInit).initStream(...)
/opt/homebrew/Cellar/encore/1.48.1/libexec/runtimes/go/appruntime/shared/reqtrack/trace_stream.go:55
encore.dev/appruntime/shared/reqtrack.(*lazyTraceInit).Logger(0xc0002341c0)
/opt/homebrew/Cellar/encore/1.48.1/libexec/runtimes/go/appruntime/shared/reqtrack/trace_stream.go:46 +0x68 fp=0xc000094ab0 sp=0xc000094a60 pc=0x102f36608
encore.dev/appruntime/shared/reqtrack.(*RequestTracker).currentReq(0xc0002270e0)
/opt/homebrew/Cellar/encore/1.48.1/libexec/runtimes/go/appruntime/shared/reqtrack/impl.go:183 +0xa0 fp=0xc000094b10 sp=0xc000094ab0 pc=0x102f353b0
encore.dev/appruntime/shared/reqtrack.(*RequestTracker).Current(0xc0002270e0)
/opt/homebrew/Cellar/encore/1.48.1/libexec/runtimes/go/appruntime/shared/reqtrack/reqtrack.go:100 +0x2c fp=0xc000094b50 sp=0xc000094b10 pc=0x102f35d6c
encore.dev/appruntime/shared/testsupport.(*Manager).StartTest(0xc0000e0240, 0xc000003a40, 0x10328bb48)
/opt/homebrew/Cellar/encore/1.48.1/libexec/runtimes/go/appruntime/shared/testsupport/testsupport.go:110 +0xb9c fp=0xc000094e90 sp=0xc000094b50 pc=0x102f4e97c
testing.encoreStartTest(0xc000003a40, 0x10328bb48)
/opt/homebrew/Cellar/encore/1.48.1/libexec/runtimes/go/appruntime/shared/testsupport/runtimehooks_app.go:31 +0x74 fp=0xc000094ec0 sp=0xc000094e90 pc=0x102f50924
testing.tRunner(0xc000003a40, 0x10328bb48)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:1654 +0x8c fp=0xc000094fa0 sp=0xc000094ec0 pc=0x1029f207c
testing.(*T).Run.gowrap1()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:1863 +0x44 fp=0xc000094fd0 sp=0xc000094fa0 pc=0x1029f3694
runtime.goexit({})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc000094fd0 sp=0xc000094fd0 pc=0x1028eefb4
created by testing.(*T).Run in goroutine 1
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:1863 +0x688
goroutine 1 gp=0xc0000021c0 m=nil [chan receive]:
runtime.gopark(0x3002274a0?, 0x1047e4030?, 0x8?, 0x81?, 0x18?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:435 +0xc8 fp=0xc00004b680 sp=0xc00004b660 pc=0x1028e66f8
runtime.chanrecv(0xc0000ae460, 0xc00004b796, 0x1)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/chan.go:664 +0x3cc fp=0xc00004b710 sp=0xc00004b680 pc=0x10287d32c
runtime.chanrecv1(0x10372b220?, 0x10318c280?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/chan.go:506 +0x14 fp=0xc00004b740 sp=0xc00004b710 pc=0x10287cf24
testing.(*T).Run(0xc000003880, {0x103027e0d, 0x9}, 0x10328bb48)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:1871 +0x6a4 fp=0xc00004b880 sp=0xc00004b740 pc=0x1029f34a4
testing.runTests.func1(0xc000003880)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:2291 +0x80 fp=0xc00004b8d0 sp=0xc00004b880 pc=0x1029f6c70
testing.tRunner(0xc000003880, 0xc0000a2aa0)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:1804 +0x18c fp=0xc00004b9b0 sp=0xc00004b8d0 pc=0x1029f217c
testing.runTests(0xc00000d4a0, {0x103716390, 0x1, 0x1}, {0x4b92725c0371b3b0?, 0x0?, 0x10372bb40?})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:2289 +0x7b0 fp=0xc00004bb00 sp=0xc00004b9b0 pc=0x1029f6b20
testing.(*M).Run(0xc0002272c0)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/testing/testing.go:2154 +0xb6c fp=0xc00004be70 sp=0xc00004bb00 pc=0x1029f490c
main.main()
_testmain.go:45 +0x114 fp=0xc00004bf40 sp=0xc00004be70 pc=0x102fa1fe4
runtime.main()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:283 +0x284 fp=0xc00004bfd0 sp=0xc00004bf40 pc=0x1028af0d4
runtime.goexit({})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc00004bfd0 sp=0xc00004bfd0 pc=0x1028eefb4
goroutine 2 gp=0xc000002700 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x1036b66f0?, 0x0?, 0xd1?, 0x0?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:435 +0xc8 fp=0xc000084790 sp=0xc000084770 pc=0x1028e66f8
runtime.goparkunlock(...)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:441
runtime.forcegchelper()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:348 +0xb8 fp=0xc0000847d0 sp=0xc000084790 pc=0x1028af438
runtime.goexit({})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc0000847d0 sp=0xc0000847d0 pc=0x1028eefb4
created by runtime.init.7 in goroutine 1
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:336 +0x24
goroutine 3 gp=0xc000002c40 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:435 +0xc8 fp=0xc000090f60 sp=0xc000090f40 pc=0x1028e66f8
runtime.goparkunlock(...)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:441
runtime.bgsweep(0xc0000a0000)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgcsweep.go:276 +0xa0 fp=0xc000090fb0 sp=0xc000090f60 pc=0x102897ef0
runtime.gcenable.gowrap1()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgc.go:204 +0x28 fp=0xc000090fd0 sp=0xc000090fb0 pc=0x10288bd68
runtime.goexit({})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc000090fd0 sp=0xc000090fd0 pc=0x1028eefb4
created by runtime.gcenable in goroutine 1
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgc.go:204 +0x6c
goroutine 4 gp=0xc000002e00 m=nil [GC scavenge wait]:
runtime.gopark(0xc0000a0000?, 0x103127558?, 0x1?, 0x0?, 0xc000002e00?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:435 +0xc8 fp=0xc000095f60 sp=0xc000095f40 pc=0x1028e66f8
runtime.goparkunlock(...)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:441
runtime.(*scavengerState).park(0x10372bcc0)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgcscavenge.go:425 +0x5c fp=0xc000095f90 sp=0xc000095f60 pc=0x1028959fc
runtime.bgscavenge(0xc0000a0000)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgcscavenge.go:653 +0x44 fp=0xc000095fb0 sp=0xc000095f90 pc=0x102895f34
runtime.gcenable.gowrap2()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgc.go:205 +0x28 fp=0xc000095fd0 sp=0xc000095fb0 pc=0x10288bd08
runtime.goexit({})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc000095fd0 sp=0xc000095fd0 pc=0x1028eefb4
created by runtime.gcenable in goroutine 1
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgc.go:205 +0xac
goroutine 5 gp=0xc000003340 m=nil [finalizer wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:435 +0xc8 fp=0xc000184d90 sp=0xc000184d70 pc=0x1028e66f8
runtime.runfinq()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mfinal.go:196 +0x12c fp=0xc000184fd0 sp=0xc000184d90 pc=0x10288ad6c
runtime.goexit({})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc000184fd0 sp=0xc000184fd0 pc=0x1028eefb4
created by runtime.createfing in goroutine 1
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mfinal.go:166 +0x80
goroutine 6 gp=0xc000003500 m=nil [chan receive]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/proc.go:435 +0xc8 fp=0xc000185ee0 sp=0xc000185ec0 pc=0x1028e66f8
runtime.chanrecv(0xc0000ae0e0, 0x0, 0x1)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/chan.go:664 +0x3cc fp=0xc000185f70 sp=0xc000185ee0 pc=0x10287d32c
runtime.chanrecv1(0x0?, 0x0?)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/chan.go:506 +0x14 fp=0xc000185fa0 sp=0xc000185f70 pc=0x10287cf24
runtime.unique_runtime_registerUniqueMapCleanup.func2(...)
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgc.go:1796
runtime.unique_runtime_registerUniqueMapCleanup.gowrap1()
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgc.go:1799 +0x3c fp=0xc000185fd0 sp=0xc000185fa0 pc=0x10288ef8c
runtime.goexit({})
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc000185fd0 sp=0xc000185fd0 pc=0x1028eefb4
created by unique.runtime_registerUniqueMapCleanup in goroutine 1
/opt/homebrew/Cellar/encore/1.48.1/libexec/encore-go/src/runtime/mgc.go:1794 +0x78
r0 0x0
r1 0x1028b9dec
r2 0xc000003dc0
r3 0xc000003c00
r4 0xc0000867d0
r5 0xc000003e58
r6 0x1
r7 0xc000086000
r8 0x400
r9 0x10282c22c
r10 0x10372d100
r11 0x10372c280
r12 0x7332020040470
r13 0x14bce0b78
r14 0x4018
r15 0x0
r16 0x16d5c7030
r17 0x16d5d6700
r18 0x0
r19 0x1028b9dec
r20 0x0
r21 0x3
r22 0x13
r23 0x1f87f4018
r24 0x1f87f4150
r25 0x16d5d6b90
r26 0x16d5d6880
r27 0x103753000
r28 0x10372c280
r29 0x16d5d6838
lr 0x1028efdc8
sp 0x16d5d6810
pc 0x10282c23c
fault 0x10
FAIL encore.app/hello 0.194s
FAIL
── Test Failure ───────────────────────────────────────────────────────────────────────────[E1000]──
One or more more tests failed.Source: encoredev/encore