Host instrumentation seg faults on start if using go test -race
[MacOS][Sequoia 15.2][M1 ARM][Go 1.23.4] #6625
Open
Description
Description
Host packages does not work with the race detector, causes a fault on OSX Sequia 15.2 on an m1 due to some type of cgo interaction, which looks like is happening through purego.
You can see thread: https://groups.google.com/g/golang-nuts/c/ay5ngSh8W5A
Environment
- OS: MacOS 15.2
- Architecture: arm M1
- Go Version: go version go1.23.4 darwin/arm64
host
version: v0.58.0
Steps To Reproduce
metrics.go
package metrics
import (
_ "[go.opentelemetry.io/contrib/instrumentation/host](http://go.opentelemetry.io/contrib/instrumentation/host)"
)
metrics_test.go
package metrics
go test -race
Even without tests, its going to dump.
Here is the error:
❯ go test -race
SIGSEGV: segmentation violation
PC=0x10428023c m=0 sigcode=2 addr=0x10
signal arrived during cgo execution
goroutine 1 gp=0xc0000021c0 m=0 mp=0x104777040 [syscall, locked to thread]:
runtime.cgocall(0x104455c80, 0x0)
/usr/local/go/src/runtime/cgocall.go:167 +0x58 fp=0xc00006bf40 sp=0xc00006bf00 pc=0x10432d3e8
runtime.main()
/usr/local/go/src/runtime/proc.go:243 +0x210 fp=0xc00006bfd0 sp=0xc00006bf40 pc=0x1042fab90
runtime.goexit({})
/usr/local/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc00006bfd0 sp=0xc00006bfd0 pc=0x10433b884
goroutine 18 gp=0xc000102380 m=nil [force gc (idle)]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:424 +0xc8 fp=0xc000052790 sp=0xc000052770 pc=0x104333648
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:430
runtime.forcegchelper()
/usr/local/go/src/runtime/proc.go:337 +0xb8 fp=0xc0000527d0 sp=0xc000052790 pc=0x1042faf78
runtime.goexit({})
/usr/local/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc0000527d0 sp=0xc0000527d0 pc=0x10433b884
created by runtime.init.7 in goroutine 1
/usr/local/go/src/runtime/proc.go:325 +0x24
goroutine 19 gp=0xc000102540 m=nil [GC sweep wait]:
runtime.gopark(0x0?, 0x0?, 0x0?, 0x0?, 0x0?)
/usr/local/go/src/runtime/proc.go:424 +0xc8 fp=0xc00006cf60 sp=0xc00006cf40 pc=0x104333648
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:430
runtime.bgsweep(0xc000112000)
/usr/local/go/src/runtime/mgcsweep.go:277 +0xa0 fp=0xc00006cfb0 sp=0xc00006cf60 pc=0x1042e3310
runtime.gcenable.gowrap1()
/usr/local/go/src/runtime/mgc.go:204 +0x28 fp=0xc00006cfd0 sp=0xc00006cfb0 pc=0x1042d7268
runtime.goexit({})
/usr/local/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc00006cfd0 sp=0xc00006cfd0 pc=0x10433b884
created by runtime.gcenable in goroutine 1
/usr/local/go/src/runtime/mgc.go:204 +0x6c
goroutine 20 gp=0xc000102700 m=nil [GC scavenge wait]:
runtime.gopark(0xc000112000?, 0x104567668?, 0x1?, 0x0?, 0xc000102700?)
/usr/local/go/src/runtime/proc.go:424 +0xc8 fp=0xc000066f60 sp=0xc000066f40 pc=0x104333648
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:430
runtime.(*scavengerState).park(0x104776580)
/usr/local/go/src/runtime/mgcscavenge.go:425 +0x5c fp=0xc000066f90 sp=0xc000066f60 pc=0x1042e0d0c
runtime.bgscavenge(0xc000112000)
/usr/local/go/src/runtime/mgcscavenge.go:653 +0x44 fp=0xc000066fb0 sp=0xc000066f90 pc=0x1042e1254
runtime.gcenable.gowrap2()
/usr/local/go/src/runtime/mgc.go:205 +0x28 fp=0xc000066fd0 sp=0xc000066fb0 pc=0x1042d7208
runtime.goexit({})
/usr/local/go/src/runtime/asm_arm64.s:1223 +0x4 fp=0xc000066fd0 sp=0xc000066fd0 pc=0x10433b884
created by runtime.gcenable in goroutine 1
/usr/local/go/src/runtime/mgc.go:205 +0xac
r0 0x0
r1 0x104455c90
r2 0xc00006bef0
r3 0x1047767a0
r4 0x110
r5 0xc00006b000
r6 0x1
r7 0x0
r8 0x104777040
r9 0x10428022c
r10 0x104777040
r11 0x1047767a0
r12 0x1000000000000000
r13 0x16bb81d50
r14 0xffffff0000000000
r15 0x4
r16 0xc00006b6c0
r17 0x206536cc0
r18 0x0
r19 0x104455c90
r20 0x0
r21 0x16bb81d30
r22 0x1047a8e6c
r23 0x16bb81eb8
r24 0x19429e000
r25 0x0
r26 0x1045e44f0
r27 0x1047a8000
r28 0x1047767a0
r29 0x16bb81cc8
lr 0x10433c688
sp 0x16bb81ca0
pc 0x10428023c
fault 0x10
-----
SIGQUIT: quit
PC=0x1945e66ec m=2 sigcode=0
goroutine 0 gp=0xc000002a80 m=2 mp=0xc00005c808 [idle]:
runtime.pthread_cond_timedwait_relative_np(0xc00005cd48, 0xc00005cd08, 0x16c386dc0)
/usr/local/go/src/runtime/sys_darwin.go:557 +0x20 fp=0x16c386d90 sp=0x16c386d60 pc=0x10431ab10
runtime.semasleep(0xdf8475800)
/usr/local/go/src/runtime/os_darwin.go:65 +0x100 fp=0x16c386df0 sp=0x16c386d90 pc=0x1042f4fa0
runtime.notetsleep_internal(0x104778c60, 0xdf8475800, 0x1e8fda97980b?, 0xc000002a80?)
/usr/local/go/src/runtime/lock_sema.go:234 +0x128 fp=0x16c386e30 sp=0x16c386df0 pc=0x1042ccaf8
runtime.notetsleep(0x104778c60, 0xdf8475800)
/usr/local/go/src/runtime/lock_sema.go:285 +0x4c fp=0x16c386e60 sp=0x16c386e30 pc=0x1042cccbc
runtime.sysmon()
/usr/local/go/src/runtime/proc.go:6098 +0x224 fp=0x16c386ed0 sp=0x16c386e60 pc=0x1043086b4
runtime.mstart1()
/usr/local/go/src/runtime/proc.go:1834 +0x88 fp=0x16c386f00 sp=0x16c386ed0 pc=0x1042fe038
runtime.mstart0()
/usr/local/go/src/runtime/proc.go:1791 +0x64 fp=0x16c386f30 sp=0x16c386f00 pc=0x1042fdf94
runtime.mstart()
/usr/local/go/src/runtime/asm_arm64.s:129 +0x10 fp=0x16c386f40 sp=0x16c386f30 pc=0x1043392e0
r0 0x104
r1 0x0
r2 0x0
r3 0x0
r4 0x0
r5 0xa0
r6 0x3b
r7 0x3b9ac9d6
r8 0x1
r9 0x0
r10 0x0
r11 0x2
r12 0x2
r13 0x0
r14 0x0
r15 0x0
r16 0x131
r17 0x206536c68
r18 0x0
r19 0xc00005cd08
r20 0xc00005cd48
r21 0x1
r22 0x3b9ac9d6
r23 0x3b
r24 0x0
r25 0x1
r26 0x100
r27 0x1047a8000
r28 0xc000002a80
r29 0x16c386cf0
lr 0x1946248c0
sp 0x16c386c60
pc 0x1945e66ec
fault 0x1945e66ec
-----
SIGQUIT: quit
PC=0x1945e66ec m=3 sigcode=0
goroutine 0 gp=0xc000002e00 m=3 mp=0xc00005d008 [idle]:
runtime.pthread_cond_wait(0xc00005d548, 0xc00005d508)
/usr/local/go/src/runtime/sys_darwin.go:547 +0x20 fp=0x16cb8ed50 sp=0x16cb8ed20 pc=0x10431aad0
runtime.semasleep(0xffffffffffffffff)
/usr/local/go/src/runtime/os_darwin.go:71 +0x84 fp=0x16cb8edb0 sp=0x16cb8ed50 pc=0x1042f4f24
runtime.notesleep(0xc00005d148)
/usr/local/go/src/runtime/lock_sema.go:183 +0xb8 fp=0x16cb8edf0 sp=0x16cb8edb0 pc=0x1042cc928
runtime.mPark(...)
/usr/local/go/src/runtime/proc.go:1866
runtime.stopm()
/usr/local/go/src/runtime/proc.go:2885 +0x84 fp=0x16cb8ee20 sp=0x16cb8edf0 pc=0x1042ffd14
runtime.startlockedm(0x1047a8000?)
/usr/local/go/src/runtime/proc.go:3168 +0x5c fp=0x16cb8ee50 sp=0x16cb8ee20 pc=0x10430079c
runtime.schedule()
/usr/local/go/src/runtime/proc.go:4041 +0x5c fp=0x16cb8ee90 sp=0x16cb8ee50 pc=0x104302f7c
runtime.park_m(0xc000102540)
/usr/local/go/src/runtime/proc.go:4102 +0x244 fp=0x16cb8eef0 sp=0x16cb8ee90 pc=0x104303464
runtime.mcall()
/usr/local/go/src/runtime/asm_arm64.s:193 +0x54 fp=0x16cb8ef00 sp=0x16cb8eef0 pc=0x104339354
r0 0x104
r1 0x0
r2 0x300
r3 0x0
r4 0x0
r5 0xa0
r6 0x0
r7 0x0
r8 0x16cb8ec38
r9 0x0
r10 0x0
r11 0x2
r12 0x2
r13 0x0
r14 0x0
r15 0x0
r16 0x131
r17 0x206536c68
r18 0x0
r19 0xc00005d508
r20 0xc00005d548
r21 0x16cb8f0e0
r22 0x0
r23 0x0
r24 0x300
r25 0x301
r26 0x400
r27 0x104768000
r28 0xc000002e00
r29 0x16cb8ecb0
lr 0x194624894
sp 0x16cb8ec20
pc 0x1945e66ec
fault 0x1945e66ec
-----
SIGQUIT: quit
PC=0x1945e66ec m=4 sigcode=0
goroutine 0 gp=0xc000003180 m=4 mp=0xc00005d808 [idle]:
runtime.pthread_cond_wait(0xc00005dd48, 0xc00005dd08)
/usr/local/go/src/runtime/sys_darwin.go:547 +0x20 fp=0x16d396c50 sp=0x16d396c20 pc=0x10431aad0
runtime.semasleep(0xffffffffffffffff)
/usr/local/go/src/runtime/os_darwin.go:71 +0x84 fp=0x16d396cb0 sp=0x16d396c50 pc=0x1042f4f24
runtime.notesleep(0xc00005d948)
/usr/local/go/src/runtime/lock_sema.go:183 +0xb8 fp=0x16d396cf0 sp=0x16d396cb0 pc=0x1042cc928
runtime.mPark(...)
/usr/local/go/src/runtime/proc.go:1866
runtime.stopm()
/usr/local/go/src/runtime/proc.go:2885 +0x84 fp=0x16d396d20 sp=0x16d396cf0 pc=0x1042ffd14
runtime.findRunnable()
/usr/local/go/src/runtime/proc.go:3622 +0x1004 fp=0x16d396e90 sp=0x16d396d20 pc=0x104301b04
runtime.schedule()
/usr/local/go/src/runtime/proc.go:3995 +0x98 fp=0x16d396ed0 sp=0x16d396e90 pc=0x104302fb8
runtime.mstart1()
/usr/local/go/src/runtime/proc.go:1841 +0xb8 fp=0x16d396f00 sp=0x16d396ed0 pc=0x1042fe068
runtime.mstart0()
/usr/local/go/src/runtime/proc.go:1791 +0x64 fp=0x16d396f30 sp=0x16d396f00 pc=0x1042fdf94
runtime.mstart()
/usr/local/go/src/runtime/asm_arm64.s:129 +0x10 fp=0x16d396f40 sp=0x16d396f30 pc=0x1043392e0
r0 0x104
r1 0x0
r2 0x200
r3 0x0
r4 0x0
r5 0xa0
r6 0x0
r7 0x0
r8 0x16d396b38
r9 0x0
r10 0x0
r11 0x2
r12 0x2
r13 0x0
r14 0x0
r15 0x0
r16 0x131
r17 0x206536c68
r18 0x0
r19 0xc00005dd08
r20 0xc00005dd48
r21 0x16d3970e0
r22 0x0
r23 0x0
r24 0x200
r25 0x201
r26 0x300
r27 0x104768000
r28 0xc000003180
r29 0x16d396bb0
lr 0x194624894
sp 0x16d396b20
pc 0x1945e66ec
fault 0x1945e66ec
-----
SIGQUIT: quit
PC=0x1945e66ec m=5 sigcode=0
goroutine 0 gp=0xc0001021c0 m=5 mp=0xc000100008 [idle]:
runtime.pthread_cond_wait(0xc000100548, 0xc000100508)
/usr/local/go/src/runtime/sys_darwin.go:547 +0x20 fp=0x16dba2d50 sp=0x16dba2d20 pc=0x10431aad0
runtime.semasleep(0xffffffffffffffff)
/usr/local/go/src/runtime/os_darwin.go:71 +0x84 fp=0x16dba2db0 sp=0x16dba2d50 pc=0x1042f4f24
runtime.notesleep(0xc000100148)
/usr/local/go/src/runtime/lock_sema.go:183 +0xb8 fp=0x16dba2df0 sp=0x16dba2db0 pc=0x1042cc928
runtime.mPark(...)
/usr/local/go/src/runtime/proc.go:1866
runtime.stopm()
/usr/local/go/src/runtime/proc.go:2885 +0x84 fp=0x16dba2e20 sp=0x16dba2df0 pc=0x1042ffd14
runtime.startlockedm(0xc000100008?)
/usr/local/go/src/runtime/proc.go:3168 +0x5c fp=0x16dba2e50 sp=0x16dba2e20 pc=0x10430079c
runtime.schedule()
/usr/local/go/src/runtime/proc.go:4041 +0x5c fp=0x16dba2e90 sp=0x16dba2e50 pc=0x104302f7c
runtime.park_m(0xc000102700)
/usr/local/go/src/runtime/proc.go:4102 +0x244 fp=0x16dba2ef0 sp=0x16dba2e90 pc=0x104303464
runtime.mcall()
/usr/local/go/src/runtime/asm_arm64.s:193 +0x54 fp=0x16dba2f00 sp=0x16dba2ef0 pc=0x104339354
r0 0x104
r1 0x0
r2 0x200
r3 0x0
r4 0x0
r5 0xa0
r6 0x0
r7 0x0
r8 0x16dba2c38
r9 0x0
r10 0x0
r11 0x2
r12 0x2
r13 0x0
r14 0x0
r15 0x0
r16 0x131
r17 0x206536c68
r18 0x0
r19 0xc000100508
r20 0xc000100548
r21 0x16dba30e0
r22 0x0
r23 0x0
r24 0x200
r25 0x201
r26 0x300
r27 0x104768000
r28 0xc0001021c0
r29 0x16dba2cb0
lr 0x194624894
sp 0x16dba2c20
pc 0x1945e66ec
fault 0x1945e66ec
-----
SIGQUIT: quit
PC=0x1945e66ec m=6 sigcode=0
goroutine 0 gp=0xc0001821c0 m=6 mp=0xc000180008 [idle]:
runtime.pthread_cond_wait(0xc000180548, 0xc000180508)
/usr/local/go/src/runtime/sys_darwin.go:547 +0x20 fp=0x16e3b2c50 sp=0x16e3b2c20 pc=0x10431aad0
runtime.semasleep(0xffffffffffffffff)
/usr/local/go/src/runtime/os_darwin.go:71 +0x84 fp=0x16e3b2cb0 sp=0x16e3b2c50 pc=0x1042f4f24
runtime.notesleep(0xc000180148)
/usr/local/go/src/runtime/lock_sema.go:183 +0xb8 fp=0x16e3b2cf0 sp=0x16e3b2cb0 pc=0x1042cc928
runtime.mPark(...)
/usr/local/go/src/runtime/proc.go:1866
runtime.stopm()
/usr/local/go/src/runtime/proc.go:2885 +0x84 fp=0x16e3b2d20 sp=0x16e3b2cf0 pc=0x1042ffd14
runtime.findRunnable()
/usr/local/go/src/runtime/proc.go:3622 +0x1004 fp=0x16e3b2e90 sp=0x16e3b2d20 pc=0x104301b04
runtime.schedule()
/usr/local/go/src/runtime/proc.go:3995 +0x98 fp=0x16e3b2ed0 sp=0x16e3b2e90 pc=0x104302fb8
runtime.mstart1()
/usr/local/go/src/runtime/proc.go:1841 +0xb8 fp=0x16e3b2f00 sp=0x16e3b2ed0 pc=0x1042fe068
runtime.mstart0()
/usr/local/go/src/runtime/proc.go:1791 +0x64 fp=0x16e3b2f30 sp=0x16e3b2f00 pc=0x1042fdf94
runtime.mstart()
/usr/local/go/src/runtime/asm_arm64.s:129 +0x10 fp=0x16e3b2f40 sp=0x16e3b2f30 pc=0x1043392e0
r0 0x104
r1 0x0
r2 0x200
r3 0x0
r4 0x0
r5 0xa0
r6 0x0
r7 0x0
r8 0x16e3b2b38
r9 0x0
r10 0x0
r11 0x2
r12 0x2
r13 0x0
r14 0x0
r15 0x0
r16 0x131
r17 0x206536c68
r18 0x0
r19 0xc000180508
r20 0xc000180548
r21 0x16e3b30e0
r22 0x0
r23 0x0
r24 0x200
r25 0x201
r26 0x300
r27 0x104768000
r28 0xc0001821c0
r29 0x16e3b2bb0
lr 0x194624894
sp 0x16e3b2b20
pc 0x1945e66ec
fault 0x1945e66ec
-----
SIGQUIT: quit
PC=0x1945e66ec m=7 sigcode=0
goroutine 0 gp=0xc000182540 m=7 mp=0xc000180808 [idle]:
runtime.pthread_cond_wait(0xc000180d48, 0xc000180d08)
/usr/local/go/src/runtime/sys_darwin.go:547 +0x20 fp=0x16ebbae10 sp=0x16ebbade0 pc=0x10431aad0
runtime.semasleep(0xffffffffffffffff)
/usr/local/go/src/runtime/os_darwin.go:71 +0x84 fp=0x16ebbae70 sp=0x16ebbae10 pc=0x1042f4f24
runtime.notesleep(0x1047a92d8)
/usr/local/go/src/runtime/lock_sema.go:183 +0xb8 fp=0x16ebbaeb0 sp=0x16ebbae70 pc=0x1042cc928
runtime.templateThread()
/usr/local/go/src/runtime/proc.go:2863 +0x94 fp=0x16ebbaed0 sp=0x16ebbaeb0 pc=0x1042ffc04
runtime.mstart1()
/usr/local/go/src/runtime/proc.go:1834 +0x88 fp=0x16ebbaf00 sp=0x16ebbaed0 pc=0x1042fe038
runtime.mstart0()
/usr/local/go/src/runtime/proc.go:1791 +0x64 fp=0x16ebbaf30 sp=0x16ebbaf00 pc=0x1042fdf94
runtime.mstart()
/usr/local/go/src/runtime/asm_arm64.s:129 +0x10 fp=0x16ebbaf40 sp=0x16ebbaf30 pc=0x1043392e0
r0 0x104
r1 0x0
r2 0x0
r3 0x0
r4 0x0
r5 0xa0
r6 0x0
r7 0x0
r8 0x16ebbacf8
r9 0x0
r10 0x0
r11 0x2
r12 0x2
r13 0x0
r14 0x0
r15 0x0
r16 0x131
r17 0x206536c68
r18 0x0
r19 0xc000180d08
r20 0xc000180d48
r21 0x16ebbb0e0
r22 0x0
r23 0x0
r24 0x0
r25 0x1
r26 0x100
r27 0x104768000
r28 0xc000182540
r29 0x16ebbad70
lr 0x194624894
sp 0x16ebbace0
pc 0x1945e66ec
fault 0x1945e66ec
signal: abort trap
Expected behavior
The test should run or at least tell you that there are no tests to run.