Skip to content

runtime: SIGSEGV via go test with -race -cover and -tags netgo on alpine linux/arm64 #59369

Open
@GeorgeMac

Description

@GeorgeMac
unexpected fault address 0x1412000
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x1412000 pc=0xa7e50]

goroutine 7 [running]:
runtime.throw({0x28990c?, 0x0?})
	/usr/local/go/src/runtime/panic.go:1047 +0x40 fp=0xc000204b40 sp=0xc000204b10 pc=0x72540
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:851 +0x1a8 fp=0xc000204b80 sp=0xc000204b40 pc=0x8a638
racecallatomic()
	/usr/local/go/src/runtime/race_arm64.s:351 +0x10 fp=0xc000204ba0 sp=0xc000204b90 pc=0xa7e50
sync/atomic.AddInt32()
	/usr/local/go/src/runtime/race_arm64.s:286 +0x18 fp=0xc000204bb0 sp=0xc000204ba0 pc=0xa8248
sync/atomic.AddUint32(0x83d91a7?, 0xdbba11c8?)
	<autogenerated>:1 +0x18 fp=0xc000204be0 sp=0xc000204bb0 pc=0xa96d8
go.flipt.io/flipt/internal/storage/oplock/memory.(*Service).TryAcquire(0xc00004b0b0, {0xc000204de8?, 0x0?}, {0x289720, 0x4}, 0x1?)
	/src/internal/storage/oplock/memory/memory.go:43 +0x280 fp=0xc000204d80 sp=0xc000204be0 pc=0x22b5b0
go.flipt.io/flipt/internal/storage/oplock/testing.Harness.func1()
	/src/internal/storage/oplock/testing/testing.go:50 +0x150 fp=0xc000204f20 sp=0xc000204d80 pc=0x22b200
golang.org/x/sync/errgroup.(*Group).Go.func1()
	/go/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:75 +0x70 fp=0xc000204fd0 sp=0xc000204f20 pc=0x22a450
runtime.goexit()
	/usr/local/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0xc000204fd0 sp=0xc000204fd0 pc=0xa7134
created by golang.org/x/sync/errgroup.(*Group).Go
	/go/pkg/mod/golang.org/x/sync@v0.1.0/errgroup/errgroup.go:72 +0x108

What version of Go are you using (go version)?

$ go version
go version go1.20.2 linux/arm64

Does this issue reproduce with the latest release?

Yes. Infact I can't reproduce it on go 1.20.1

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/src/go.mod"
GOWORK="/src/go.work"
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3327561268=/tmp/go-build -gno-record-gcc-switches"

What did you do?

I can comfortably reproduce it in this particular open source package:
https://github.com/flipt-io/flipt/tree/main/internal/storage/oplock/memory

I can consistently reproduce a SIGSEV when I perform go test -cover -race -tags netgo ..

It requires all three of these flags to be present to trigger it.

What did you expect to see?

No segfault. Works for golang:1.20.1-alpine3.16 docker image. However, golang:1.20.2-alpine3:16 fails consistently with the error seen above.

What did you see instead?

A SIGSEGV fatal error.

Metadata

Metadata

Assignees

Labels

NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions