Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: encountered a SIGSEGV during 'go run' in go1.16beta1 #43284

Closed
aaronbee opened this issue Dec 19, 2020 · 5 comments
Closed

runtime: encountered a SIGSEGV during 'go run' in go1.16beta1 #43284

aaronbee opened this issue Dec 19, 2020 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Milestone

Comments

@aaronbee
Copy link

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

$ go1.16beta1 version
go version go1.16beta1 darwin/amd64

Does this issue reproduce with the latest release?

I haven't tried anything newer than go1.16beta1

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

go env Output
$ go1.16beta1 env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/aaron/Library/Caches/go-build"
GOENV="/Users/aaron/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/aaron/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/aaron/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/aaron/sdk/go1.16beta1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/aaron/sdk/go1.16beta1/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16beta1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/aaron/go/src/aoc2020/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pc/xv443hl12xq5hjbjg9qlt15w0000gn/T/go-build3589196996=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

$ GOARCH=arm64 go1.16beta1 run main.go sample.txt

Note: this is on an M1 Mac with and amd64 build of go1.16beta1, compiling a program with GOARCH=arm64.

main.go can be found here.
I only saw the SIGSEGV once. Re-runs of this same command with the same code did not fail.

What did you expect to see?

Program compiled and run.

What did you see instead?

Looks to be a crash during build cache lookup?

unexpected fault address 0x48241c894848731b
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0x48241c894848731b pc=0x113a8ab]

goroutine 28 [running]:
runtime.throw(0x164115a, 0x5)
	/usr/local/go/src/runtime/panic.go:1112 +0x72 fp=0xc000137c98 sp=0xc000137c68 pc=0x10376d2
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:737 +0x276 fp=0xc000137cd0 sp=0xc000137c98 pc=0x104e2f6
regexp.(*Regexp).doExecute(0x48241c894848728b, 0x0, 0x0, 0x0, 0x0, 0x0, 0x15bbc20, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/regexp/exec.go:527 +0x56b fp=0xc000137d90 sp=0xc000137cd0 pc=0x113a8ab
regexp.(*Regexp).doMatch(...)
	/usr/local/go/src/regexp/exec.go:514
regexp.(*Regexp).MatchString(...)
	/usr/local/go/src/regexp/regexp.go:525
internal/lazyregexp.(*Regexp).MatchString(0x1432015, 0x15bbc20, 0x0, 0x8)
	/usr/local/go/src/internal/lazyregexp/lazyre.go:59 +0xb2 fp=0xc000137e30 sp=0xc000137d90 pc=0x11461b2
runtime: unexpected return pc for cmd/go/internal/modload.(*loader).load called from 0xc000137f50
stack: frame={sp:0xc000137e30, fp:0xc000137f38} stack=[0xc000136000,0xc000138000)
000000c000137d30:  0000000000203000  0000000000203000 
000000c000137d40:  0000000000203000  000000000000000a 
000000c000137d50:  000000c0001f0800  0000000000000014 
000000c000137d60:  0000000000000006  000000c000137db8 
000000c000137d70:  000000c000137df8  000000000100f372  
000000c000137d80:  000000c000137e20  00000000011461b2  
000000c000137d90:  48241c894848728b  0000000000000000 
000000c000137da0:  0000000000000000  0000000000000000 
000000c000137db0:  0000000000000000  0000000000000000 
000000c000137dc0:  00000000015bbc20  0000000000000000 
000000c000137dd0:  0000000000000000  0000000000000000 
000000c000137de0:  0000000000000000  0000000000000000 
000000c000137df0:  0000000000000000  000000c000137e28 
000000c000137e00:  000000000104f2ec   0000000000000040 
000000c000137e10:  00000000011464a0   0000000001432015  
000000c000137e20:  000000c000137f30  0000000001432015  
000000c000137e30: <0000000001432015   00000000015bbc20 
000000c000137e40:  0000000000000000  0000000000000008 
000000c000137e50:  000000c00034e500  000000c000128d11 
000000c000137e60:  0000000000000007  000000c000366200 
000000c000137e70:  0000000000000015  0000000000000020 
000000c000137e80:  0000000000000000  0000000000000000 
000000c000137e90:  000000c000128cf0  0000000000000028 
000000c000137ea0:  0000000000000000  0000000000000000 
000000c000137eb0:  000000c000314f98  0000000000000007 
000000c000137ec0:  0000000000000001  0000000000000020 
000000c000137ed0:  0000000000000015  0000000000000008 
000000c000137ee0:  000000c00011ad21  000000c00012c4d8 
000000c000137ef0:  000000c00025e060  000000c000366200 
000000c000137f00:  000000c00034a680  000000c000162b58 
000000c000137f10:  000000c000046758  000000c000314f50 
000000c000137f20:  0000000001006dd5   000000c00012c480 
000000c000137f30: !000000c000137f50 >0000000001444893  
000000c000137f40:  000000c000148400  000000c000162b00 
000000c000137f50:  000000c000137fc0  000000000136ff3c  
000000c000137f60:  000000c00012c480  000000c000314f98 
000000c000137f70:  0000000000000008  000000c00013e7d0 
000000c000137f80:  0000000000000001  0000000000000002 
000000c000137f90:  000000c0000a4060  0000000000000008 
000000c000137fa0:  000000c00013e7d0  0000000000000001 
000000c000137fb0:  0000000000000002  000000c0000a4060 
000000c000137fc0:  0000000000000000  000000000106d701  
000000c000137fd0:  000000c00012a0c0  000000c0001115c0 
000000c000137fe0:  0000000000000000  0000000000000000 
000000c000137ff0:  0000000000000000  0000000000000000 
cmd/go/internal/modload.(*loader).load(0x1444893, 0xc000148400)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1085 +0x6f5 fp=0xc000137f38 sp=0xc000137e30 pc=0x1432015
created by cmd/go/internal/par.(*Queue).Add
	/usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x23d

goroutine 1 [chan receive]:
cmd/go/internal/modload.loadFromRoots(0xc000197fb0, 0x1, 0x0, 0x0, 0x1, 0xc0001b2b40, 0x5)
	/usr/local/go/src/cmd/go/internal/modload/load.go:831 +0x328
cmd/go/internal/modload.ImportFromFiles(0x171dda8, 0xc00011a000, 0xc00012e020, 0x1, 0x2)
	/usr/local/go/src/cmd/go/internal/modload/load.go:514 +0x23c
cmd/go/internal/load.GoFilesPackage(0x171dda8, 0xc00011a000, 0xc00012e020, 0x1, 0x2, 0x10f8275)
	/usr/local/go/src/cmd/go/internal/load/pkg.go:2513 +0x930
cmd/go/internal/run.runRun(0x171dda8, 0xc00011a000, 0x19c9100, 0xc00012e020, 0x2, 0x2)
	/usr/local/go/src/cmd/go/internal/run/run.go:80 +0x15e
main.main()
	/usr/local/go/src/cmd/go/main.go:195 +0x70c

goroutine 31 [GC assist wait]:
syscall.ByteSliceFromString(...)
	/usr/local/go/src/syscall/syscall.go:53
syscall.BytePtrFromString(...)
	/usr/local/go/src/syscall/syscall.go:69
syscall.Lstat(0xc000345d80, 0x3b, 0xc00037c038, 0xc000345d80, 0xc000345dae)
	/usr/local/go/src/syscall/zsyscall_darwin_amd64.go:2015 +0x1a5
os.lstatNolog.func1(...)
	/usr/local/go/src/os/stat_unix.go:45
os.ignoringEINTR(...)
	/usr/local/go/src/os/file_posix.go:245
os.lstatNolog(0xc000345d80, 0x3b, 0x3, 0x3, 0xc000345d80, 0x3b)
	/usr/local/go/src/os/stat_unix.go:44 +0x65
os.Lstat(0xc000345d80, 0x3b, 0x2d, 0x1706820, 0x1, 0xc00034c915)
	/usr/local/go/src/os/stat.go:22 +0x4d
os.(*File).readdir(0xc000324108, 0xffffffffffffffff, 0x2, 0x0, 0x0, 0xc0001337d8, 0x10e9445, 0xc0003183c0, 0x2d, 0x0, ...)
	/usr/local/go/src/os/dir_darwin.go:85 +0x86d
os.(*File).Readdir(0xc000324108, 0xffffffffffffffff, 0x0, 0x0, 0xc000324108, 0x0, 0x0)
	/usr/local/go/src/os/dir.go:41 +0x51
io/ioutil.ReadDir(0xc0003183c0, 0x2d, 0xc0003183c0, 0x2d, 0x10cc896, 0x171c630, 0x1a04b00)
	/usr/local/go/src/io/ioutil/ioutil.go:63 +0x90
cmd/go/internal/fsys.readDir(0xc0003183c0, 0x2d, 0xc0003183c0, 0x2d, 0x1a04b00, 0x2, 0xc00031c5e0)
	/usr/local/go/src/cmd/go/internal/fsys/fsys.go:246 +0x39
cmd/go/internal/fsys.ReadDir(0xc0003183c0, 0x2d, 0x2d, 0xc000133e28, 0x1423055, 0xc000133df8, 0x3)
	/usr/local/go/src/cmd/go/internal/fsys/fsys.go:270 +0xb45
cmd/go/internal/imports.ScanDir(0xc0003183c0, 0x2d, 0xc000197fb0, 0x10e4485, 0xc0003342f1, 0xc, 0x1431540, 0xffffffffffffffff, 0xc0000ac370, 0xc00031e200, ...)
	/usr/local/go/src/cmd/go/internal/imports/scan.go:19 +0x50
cmd/go/internal/modload.scanDir(0xc0003183c0, 0x2d, 0xc000197fb0, 0xc, 0xc00009e000, 0x3, 0x4, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1211 +0x5a
cmd/go/internal/modload.(*loader).load(0xc000148400, 0xc0003640b0)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1077 +0x3cf
cmd/go/internal/modload.(*loader).pkg.func1.1()
	/usr/local/go/src/cmd/go/internal/modload/load.go:959 +0x33
cmd/go/internal/par.(*Queue).Add.func1(0xc000324078, 0xc0001115c0)
	/usr/local/go/src/cmd/go/internal/par/queue.go:58 +0x7c
created by cmd/go/internal/par.(*Queue).Add
	/usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x23d

goroutine 35 [runnable]:
syscall.syscall(0x1084920, 0x2409650, 0xc00021ad80, 0xc000010178, 0x0, 0x0, 0x0)
	/usr/local/go/src/runtime/sys_darwin.go:63 +0x2e
syscall.readdir_r(0x2409650, 0xc00021ad80, 0xc000010178, 0xc000110040)
	/usr/local/go/src/syscall/zsyscall_darwin_amd64.go:1258 +0x65
os.(*File).readdir(0xc000010170, 0xffffffffffffffff, 0x2, 0x0, 0x0, 0xc00005d7d8, 0x10e9445, 0xc000026780, 0x28, 0x0, ...)
	/usr/local/go/src/os/dir_darwin.go:48 +0x1c5
os.(*File).Readdir(0xc000010170, 0xffffffffffffffff, 0x0, 0x0, 0xc000010170, 0x0, 0x0)
	/usr/local/go/src/os/dir.go:41 +0x51
io/ioutil.ReadDir(0xc000026780, 0x28, 0xc000026780, 0x28, 0x10cc896, 0x171c630, 0xc00000e1b0)
	/usr/local/go/src/io/ioutil/ioutil.go:63 +0x90
cmd/go/internal/fsys.readDir(0xc000026780, 0x28, 0xc000026780, 0x28, 0x1a04b00, 0x5, 0xc000218880)
	/usr/local/go/src/cmd/go/internal/fsys/fsys.go:246 +0x39
cmd/go/internal/fsys.ReadDir(0xc000026780, 0x28, 0x28, 0xc00005de28, 0x1423055, 0xc00005ddf8, 0x3)
	/usr/local/go/src/cmd/go/internal/fsys/fsys.go:270 +0xb45
cmd/go/internal/imports.ScanDir(0xc000026780, 0x28, 0xc000197fb0, 0x10e4485, 0xc000028611, 0x7, 0x1431540, 0xffffffffffffffff, 0xc0000ac370, 0xc000060400, ...)
	/usr/local/go/src/cmd/go/internal/imports/scan.go:19 +0x50
cmd/go/internal/modload.scanDir(0xc000026780, 0x28, 0xc000197fb0, 0x7, 0xc00009e000, 0x3, 0x4, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1211 +0x5a
cmd/go/internal/modload.(*loader).load(0xc000148400, 0xc00025e2c0)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1077 +0x3cf
cmd/go/internal/modload.(*loader).pkg.func1.1()
	/usr/local/go/src/cmd/go/internal/modload/load.go:959 +0x33
cmd/go/internal/par.(*Queue).Add.func1(0xc0000a8020, 0xc0001115c0)
	/usr/local/go/src/cmd/go/internal/par/queue.go:58 +0x7c
created by cmd/go/internal/par.(*Queue).Add
	/usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x23d

goroutine 36 [GC assist wait]:
cmd/go/internal/imports.(*importReader).readByte(0xc00029b928, 0xc000032000)
	/usr/local/go/src/cmd/go/internal/imports/read.go:46 +0x14d
cmd/go/internal/imports.(*importReader).peekByte(0xc00029b928, 0x1, 0xc00029b901)
	/usr/local/go/src/cmd/go/internal/imports/read.go:77 +0x1c5
cmd/go/internal/imports.(*importReader).readKeyword(0xc00029b928, 0x16424ed, 0x7)
	/usr/local/go/src/cmd/go/internal/imports/read.go:125 +0x34
cmd/go/internal/imports.ReadImports(0x1712e60, 0xc000384200, 0x0, 0xc00029baa0, 0xc000384200, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/cmd/go/internal/imports/read.go:218 +0xae
cmd/go/internal/imports.scanFiles(0xc00039e800, 0x41, 0x80, 0xc000197fb0, 0x0, 0xc00039e800, 0x40, 0x80, 0xc000380060, 0x23, ...)
	/usr/local/go/src/cmd/go/internal/imports/scan.go:58 +0x252
cmd/go/internal/imports.ScanDir(0xc000380060, 0x23, 0xc000197fb0, 0x10e4485, 0xc00011a9f9, 0x2, 0x40, 0xffffffffffffffff, 0x0, 0x0, ...)
	/usr/local/go/src/cmd/go/internal/imports/scan.go:40 +0x20e
cmd/go/internal/modload.scanDir(0xc000380060, 0x23, 0xc000197fb0, 0x2, 0xc00009e000, 0x3, 0x4, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1211 +0x5a
cmd/go/internal/modload.(*loader).load(0xc000148400, 0xc0000ac160)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1077 +0x3cf
cmd/go/internal/modload.(*loader).pkg.func1.1()
	/usr/local/go/src/cmd/go/internal/modload/load.go:959 +0x33
cmd/go/internal/par.(*Queue).Add.func1(0xc0000a8030, 0xc0001115c0)
	/usr/local/go/src/cmd/go/internal/par/queue.go:58 +0x7c
created by cmd/go/internal/par.(*Queue).Add
	/usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x23d

goroutine 38 [runnable]:
cmd/go/internal/imports.scanFiles(0xc0000e0400, 0x32, 0x40, 0xc000197fb0, 0x0, 0xc0000e0400, 0x20, 0x40, 0xc0000b8120, 0x25, ...)
	/usr/local/go/src/cmd/go/internal/imports/scan.go:70 +0x122
cmd/go/internal/imports.ScanDir(0xc0000b8120, 0x25, 0xc000197fb0, 0x10e4485, 0xc0000282f5, 0x4, 0x1431540, 0xffffffffffffffff, 0xc0000ac370, 0xc0000a6200, ...)
	/usr/local/go/src/cmd/go/internal/imports/scan.go:40 +0x20e
cmd/go/internal/modload.scanDir(0xc0000b8120, 0x25, 0xc000197fb0, 0x4, 0xc00009e000, 0x3, 0x4, 0x0, 0x0, 0x0, ...)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1211 +0x5a
cmd/go/internal/modload.(*loader).load(0xc000148400, 0xc00025e0b0)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1077 +0x3cf
cmd/go/internal/modload.(*loader).pkg.func1.1()
	/usr/local/go/src/cmd/go/internal/modload/load.go:959 +0x33
cmd/go/internal/par.(*Queue).Add.func1(0xc0000a8050, 0xc0001115c0)
	/usr/local/go/src/cmd/go/internal/par/queue.go:58 +0x7c
created by cmd/go/internal/par.(*Queue).Add
	/usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x23d

goroutine 29 [runnable]:
cmd/go/internal/modload.(*loader).load(0xc000148400, 0xc000162bb0)
	/usr/local/go/src/cmd/go/internal/modload/load.go:1087 +0x4bd
cmd/go/internal/modload.(*loader).pkg.func1.1()
	/usr/local/go/src/cmd/go/internal/modload/load.go:959 +0x33
cmd/go/internal/par.(*Queue).Add.func1(0xc00012a0d0, 0xc0001115c0)
	/usr/local/go/src/cmd/go/internal/par/queue.go:58 +0x7c
created by cmd/go/internal/par.(*Queue).Add
	/usr/local/go/src/cmd/go/internal/par/queue.go:56 +0x23d
@dmitshur
Copy link
Contributor

What macOS version were you using?

This may be the same as or related to #42700.

@aaronbee
Copy link
Author

Big Sur 11.1

@cagedmantis cagedmantis changed the title go1.16beta1: SIGSEGV during 'go run' runtime: encountered a SIGSEGV during 'go run' in go1.16beta1 Dec 21, 2020
@cagedmantis cagedmantis added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin labels Dec 21, 2020
@cagedmantis cagedmantis added this to the Go1.16 milestone Dec 21, 2020
@cagedmantis
Copy link
Contributor

As mentioned by @dmitshur, this could possibly be related to #42700

@cagedmantis
Copy link
Contributor

@cherrymui
Copy link
Member

Yeah, it is likely #42700 . I have seen a number of weird SIGSEGV or memory corruption with Rosetta 2. The new macOS 11.2 beta seems to make things better. Closing as a dup for now. (Feel free to reopen if you don't think so.)

Since you're building for ARM64 anyway, you can download an ARM64 toolchain from https://golang.org/dl/#go1.16beta1

@golang golang locked and limited conversation to collaborators Dec 21, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Darwin
Projects
None yet
Development

No branches or pull requests

5 participants