Skip to content

Go programs stored on AFS may crash with SIGBUS #50545

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

Closed
bburghgr opened this issue Jan 11, 2022 · 7 comments
Closed

Go programs stored on AFS may crash with SIGBUS #50545

bburghgr opened this issue Jan 11, 2022 · 7 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@bburghgr
Copy link

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

$ go version
go version go1.17.6 linux/amd64

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/afs/cern.ch/user/b/bburghgr/.cache/go-build"
GOENV="/afs/cern.ch/user/b/bburghgr/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/afs/cern.ch/user/b/bburghgr/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/afs/cern.ch/user/b/bburghgr/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/afs/cern.ch/user/b/bburghgr/temp/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/afs/cern.ch/user/b/bburghgr/temp/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.6"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/bburghgr/go-build2920779658=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Attempt to run a go binary (including the main go binary) from an AFS volume:

rm -rvf ~/.cache/go-build/
mkdir temp
cd temp
wget https://go.dev/dl/go1.17.6.linux-amd64.tar.gz
tar xvf go1.17.6.linux-amd64.tar.gz
./go/bin/go test ./go/src/...

What did you expect to see?

The application should run normally, i.e. without a SIGBUS signal.

What did you see instead?

The program (at least one of the tests, in this case) crashes with a SIGBUS. Note that the problem seems to happen inconsistently, so short workflows seem more likely to succeed without problems, but clearing the caches and retrying seems to reproduce it within a couple of attempts:

./go/bin/go test ./go/src/... Output
ok  	archive/tar	0.178s
ok  	archive/zip	41.737s
ok  	bufio	0.236s
ok  	bytes	2.093s
ok  	compress/bzip2	0.113s
ok  	compress/flate	11.861s
ok  	compress/gzip	0.077s
ok  	compress/lzw	0.089s
ok  	compress/zlib	1.319s
ok  	container/heap	0.045s
ok  	container/list	0.057s
ok  	container/ring	0.051s
ok  	context	0.075s
ok  	crypto	0.006s
ok  	crypto/aes	0.033s
ok  	crypto/cipher	0.413s
ok  	crypto/des	0.047s
ok  	crypto/dsa	7.398s
ok  	crypto/ecdsa	3.067s
ok  	crypto/ed25519	0.796s
ok  	crypto/ed25519/internal/edwards25519	5.503s
ok  	crypto/ed25519/internal/edwards25519/field	2.508s
ok  	crypto/elliptic	2.542s
ok  	crypto/elliptic/internal/fiat	0.012s
ok  	crypto/hmac	0.050s
?   	crypto/internal/randutil	[no test files]
ok  	crypto/internal/subtle	0.040s
ok  	crypto/md5	0.028s
ok  	crypto/rand	0.486s
ok  	crypto/rc4	0.047s
ok  	crypto/rsa	0.626s
ok  	crypto/sha1	0.049s
ok  	crypto/sha256	0.068s
ok  	crypto/sha512	0.025s
ok  	crypto/subtle	0.040s
ok  	crypto/tls	6.205s
ok  	crypto/x509	2.017s
?   	crypto/x509/pkix	[no test files]
ok  	database/sql	1.464s
ok  	database/sql/driver	0.056s
ok  	debug/dwarf	0.024s
ok  	debug/elf	0.060s
ok  	debug/gosym	1.033s
ok  	debug/macho	0.016s
ok  	debug/pe	0.040s
ok  	debug/plan9obj	0.030s
?   	embed	[no test files]
ok  	embed/internal/embedtest	0.040s
?   	encoding	[no test files]
ok  	encoding/ascii85	0.043s
ok  	encoding/asn1	0.030s
ok  	encoding/base32	0.027s
ok  	encoding/base64	0.026s
ok  	encoding/binary	0.109s
ok  	encoding/csv	0.010s
ok  	encoding/gob	0.108s
ok  	encoding/hex	0.024s
ok  	encoding/json	2.096s
ok  	encoding/pem	0.017s
ok  	encoding/xml	0.061s
ok  	errors	0.045s
ok  	expvar	0.006s
ok  	flag	0.158s
ok  	fmt	0.134s
ok  	go/ast	0.022s
ok  	go/build	2.402s
ok  	go/build/constraint	0.036s
ok  	go/constant	0.030s
ok  	go/doc	0.062s
ok  	go/format	0.050s
ok  	go/importer	0.501s
ok  	go/internal/gccgoimporter	0.091s
ok  	go/internal/gcimporter	2.486s
ok  	go/internal/srcimporter	9.553s
?   	go/internal/typeparams	[no test files]
ok  	go/parser	0.224s
ok  	go/printer	0.557s
ok  	go/scanner	0.033s
ok  	go/token	0.035s
ok  	go/types	60.487s
ok  	hash	0.012s
ok  	hash/adler32	0.015s
ok  	hash/crc32	0.055s
ok  	hash/crc64	0.109s
ok  	hash/fnv	0.087s
ok  	hash/maphash	165.150s
ok  	html	0.027s
ok  	html/template	0.662s
ok  	image	0.388s
ok  	image/color	0.029s
?   	image/color/palette	[no test files]
ok  	image/draw	0.071s
ok  	image/gif	0.866s
?   	image/internal/imageutil	[no test files]
ok  	image/jpeg	0.357s
ok  	image/png	1.462s
ok  	index/suffixarray	81.850s
ok  	internal/abi	0.217s
?   	internal/buildcfg	[no test files]
?   	internal/bytealg	[no test files]
?   	internal/cfg	[no test files]
ok  	internal/cpu	0.114s
ok  	internal/execabs	0.044s
ok  	internal/fmtsort	0.018s
?   	internal/goexperiment	[no test files]
?   	internal/goroot	[no test files]
?   	internal/goversion	[no test files]
ok  	internal/itoa	0.045s
?   	internal/lazyregexp	[no test files]
?   	internal/lazytemplate	[no test files]
?   	internal/nettrace	[no test files]
?   	internal/obscuretestdata	[no test files]
?   	internal/oserror	[no test files]
ok  	internal/poll	0.833s
ok  	internal/profile	0.023s
?   	internal/race	[no test files]
ok  	internal/reflectlite	0.140s
ok  	internal/singleflight	0.051s
?   	internal/syscall/execenv	[no test files]
?   	internal/syscall/unix	[no test files]
?   	internal/sysinfo	[no test files]
?   	internal/testenv	[no test files]
?   	internal/testlog	[no test files]
ok  	internal/trace	2.279s
ok  	internal/unsafeheader	0.033s
ok  	internal/xcoff	0.047s
ok  	io	0.150s
ok  	io/fs	0.023s
ok  	io/ioutil	0.064s
ok  	log	0.028s
ok  	log/syslog	1.347s
ok  	math	0.025s
ok  	math/big	6.155s
ok  	math/bits	0.012s
ok  	math/cmplx	0.005s
ok  	math/rand	7.547s
ok  	mime	0.052s
ok  	mime/multipart	1.014s
ok  	mime/quotedprintable	0.407s
ok  	net	42.705s
ok  	net/http	85.905s
ok  	net/http/cgi	0.929s
ok  	net/http/cookiejar	0.036s
ok  	net/http/fcgi	0.122s
ok  	net/http/httptest	0.041s
ok  	net/http/httptrace	0.016s
ok  	net/http/httputil	1.417s
ok  	net/http/internal	0.020s
ok  	net/http/internal/ascii	0.083s
?   	net/http/internal/testcert	[no test files]
ok  	net/http/pprof	5.208s
ok  	net/internal/socktest	0.029s
ok  	net/mail	0.009s
ok  	net/rpc	0.176s
ok  	net/rpc/jsonrpc	0.062s
ok  	net/smtp	0.047s
ok  	net/textproto	0.138s
ok  	net/url	0.034s
ok  	os	20.661s
ok  	os/exec	2.766s
ok  	os/signal	8.953s
?   	os/signal/internal/pty	[no test files]
ok  	os/user	0.160s
ok  	path	0.074s
ok  	path/filepath	0.240s
ok  	plugin	0.073s
ok  	reflect	3.289s
?   	reflect/internal/example1	[no test files]
?   	reflect/internal/example2	[no test files]
ok  	regexp	24.081s
ok  	regexp/syntax	0.697s
--- FAIL: TestRaceProf (2.61s)
    crash_cgo_test.go:393: building testprogcgo [-race]: exit status 2
        # runtime/testdata/testprogcgo
        fatal error: unexpected signal during runtime execution
        [signal SIGBUS: bus error code=0x2 addr=0x65f7b4 pc=0x44f4fc]
    runtime stack:
    runtime.throw({0x5be319, 0x6beba8})
    	/usr/local/go/src/runtime/panic.go:1198 +0x71
    runtime.sigpanic()
    	/usr/local/go/src/runtime/signal_unix.go:719 +0x396
    runtime.step({0x65f7b4, 0x41d494, 0x5ca784}, 0x42de5c, 0xc00046a778, 0x0)
    	/usr/local/go/src/runtime/symtab.go:1030 +0x1c
    runtime.pcvalue({0x6bd8a8, 0x6ceda0}, 0x488f4, 0x51345d, 0xc000591a38, 0x1)
    	/usr/local/go/src/runtime/symtab.go:834 +0x18a
    runtime.funcspdelta({0x6bd8a8, 0x6ceda0}, 0x0, 0x0)
    	/usr/local/go/src/runtime/symtab.go:957 +0x4d
    runtime.gentraceback(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffff, 0x5c3ec0, 0x0, 0x0)
    	/usr/local/go/src/runtime/traceback.go:207 +0x59d
    runtime.copystack(0xc0000001a0, 0x4000)
    	/usr/local/go/src/runtime/stack.go:918 +0x293
    runtime.newstack()
    	/usr/local/go/src/runtime/stack.go:1097 +0x47b
    runtime.morestack()
    	/usr/local/go/src/runtime/asm_amd64.s:461 +0x8b
    
    goroutine 1 [copystack]:
    runtime.deductSweepCredit(0x2000, 0x0)
    	/usr/local/go/src/runtime/mgcsweep.go:711 +0x145 fp=0xc000546338 sp=0xc000546330 pc=0x422f65
    runtime.(*mcentral).cacheSpan(0x70ea08)
    	/usr/local/go/src/runtime/mcentral.go:82 +0x46 fp=0xc0005463b0 sp=0xc000546338 pc=0x415f86
    runtime.(*mcache).refill(0x7fe6c85ed3c8, 0xb)
    	/usr/local/go/src/runtime/mcache.go:162 +0xaf fp=0xc000546400 sp=0xc0005463b0 pc=0x41580f
    runtime.(*mcache).nextFree(0x7fe6c85ed3c8, 0xb)
    	/usr/local/go/src/runtime/malloc.go:886 +0x85 fp=0xc000546448 sp=0xc000546400 pc=0x40bfc5
    runtime.mallocgc(0x30, 0x0, 0x0)
    	/usr/local/go/src/runtime/malloc.go:1077 +0x4e8 fp=0xc0005464c8 sp=0xc000546448 pc=0x40c648
    runtime.growslice(0x5a04c0, {0x0, 0xc00046a5b8, 0x0}, 0x0)
    	/usr/local/go/src/runtime/slice.go:261 +0x4ac fp=0xc000546530 sp=0xc0005464c8 pc=0x4489ac
    go/printer.(*printer).writeString(0xc000546a00, {{0x0, 0x0}, 0x0, 0x1, 0x1}, {0xc0003272c0, 0x22}, 0x0)
    	/usr/local/go/src/go/printer/printer.go:313 +0x1e5 fp=0xc0005465b0 sp=0xc000546530 pc=0x51b725
    go/printer.(*printer).print(0xc000546a00, {0xc000546778, 0x1, 0xc0003d2600})
    	/usr/local/go/src/go/printer/printer.go:1017 +0x65b fp=0xc0005466d0 sp=0xc0005465b0 pc=0x51db1b
    go/printer.(*printer).expr1(0xc00046aa00, {0x5f11f8, 0xc0002dc020}, 0x0, 0x1)
    	/usr/local/go/src/go/printer/nodes.go:788 +0xcdd fp=0xc0005468f0 sp=0xc0005466d0 pc=0x51345d
    go/printer.(*printer).expr(...)
    	/usr/local/go/src/go/printer/nodes.go:1117
    go/printer.(*printer).printNode(0xc00046aa00, {0x5961e0, 0xc0002dc020})
    	/usr/local/go/src/go/printer/printer.go:1138 +0x375 fp=0xc000546990 sp=0xc0005468f0 pc=0x51e295
    go/printer.(*Config).fprint(0xc00046abe0, {0x5ed740, 0xc0001bc030}, 0x22, {0x5961e0, 0xc0002dc020}, 0xc0001bc000)
    	/usr/local/go/src/go/printer/printer.go:1319 +0x17c fp=0xc000546b98 sp=0xc000546990 pc=0x51ee7c
    go/printer.(*printer).nodeSize(0xc00046b360, {0x5f03d0, 0xc0002dc020}, 0xf4240)
    	/usr/local/go/src/go/printer/nodes.go:1720 +0x134 fp=0xc000546c28 sp=0xc000546b98 pc=0x519154
    go/printer.(*printer).exprList(0xc00046b360, 0xc00046b0f8, {0xc000346000, 0x1, 0x36c0046b068}, 0xf00000013, 0x1, 0xc00046b770, 0x0)
    	/usr/local/go/src/go/printer/nodes.go:213 +0x8c5 fp=0xc000547030 sp=0xc000546c28 pc=0x50f005
    go/printer.(*printer).expr1(0xc00046b360, {0x5f0ef8, 0xc000110000}, 0x0, 0x1)
    	/usr/local/go/src/go/printer/nodes.go:949 +0x1890 fp=0xc000547250 sp=0xc000547030 pc=0x514010
    go/printer.(*printer).expr(...)
    	/usr/local/go/src/go/printer/nodes.go:1117
    go/printer.(*printer).printNode(0xc00046b360, {0x58cfa0, 0xc000110000})
    	/usr/local/go/src/go/printer/printer.go:1138 +0x375 fp=0xc0005472f0 sp=0xc000547250 pc=0x51e295
    go/printer.(*Config).fprint(0xc00046b530, {0x5ed740, 0x6e5580}, 0x5c3d70, {0x58cfa0, 0xc000110000}, 0xc0001bc000)
    	/usr/local/go/src/go/printer/printer.go:1319 +0x17c fp=0xc0005474f8 sp=0xc0005472f0 pc=0x51ee7c
    go/printer.(*Config).Fprint(...)
    	/usr/local/go/src/go/printer/printer.go:1381
    go/printer.Fprint(...)
    	/usr/local/go/src/go/printer/printer.go:1390
    main.gofmt({0x58cfa0, 0xc000110000})
    	/usr/local/go/src/cmd/cgo/godefs.go:123 +0xa5 fp=0xc000547560 sp=0xc0005474f8 pc=0x55b5a5
    main.gofmtLine({0x58cfa0, 0xc000110000})
    	/usr/local/go/src/cmd/cgo/godefs.go:170 +0x25 fp=0xc000547588 sp=0xc000547560 pc=0x55b685
    main.gofmtPos({0x5f0ef8, 0xc000110000}, 0xc00022b820)
    	/usr/local/go/src/cmd/cgo/gcc.go:1540 +0x4e fp=0xc000547680 sp=0xc000547588 pc=0x54d6ae
    main.(*Package).rewriteRef(0xc000144000, 0xc000134dc0)
    	/usr/local/go/src/cmd/cgo/gcc.go:1399 +0x636 fp=0xc000547a60 sp=0xc000547680 pc=0x54bcd6
    main.(*Package).Translate(0xc000144000, 0xc000134dc0)
    	/usr/local/go/src/cmd/cgo/gcc.go:212 +0x3fb fp=0xc000547cd0 sp=0xc000547a60 pc=0x54433b
    main.main()
    	/usr/local/go/src/cmd/cgo/main.go:375 +0x6e5 fp=0xc000547f80 sp=0xc000547cd0 pc=0x55bfc5
    runtime.main()
    	/usr/local/go/src/runtime/proc.go:255 +0x227 fp=0xc000547fe0 sp=0xc000547f80 pc=0x4345e7
    runtime.goexit()
    	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc000547fe8 sp=0xc000547fe0 pc=0x45fdc1

--- FAIL: TestRaceSignal (0.00s)
crash_cgo_test.go:422: building testprogcgo [-race]: exit status 2
# runtime/testdata/testprogcgo
fatal error: unexpected signal during runtime execution
[signal SIGBUS: bus error code=0x2 addr=0x65f7b4 pc=0x44f4fc]

    runtime stack:
    runtime.throw({0x5be319, 0x6beba8})
    	/usr/local/go/src/runtime/panic.go:1198 +0x71
    runtime.sigpanic()
    	/usr/local/go/src/runtime/signal_unix.go:719 +0x396
    runtime.step({0x65f7b4, 0x41d494, 0x5ca784}, 0x42de5c, 0xc00046a778, 0x0)
    	/usr/local/go/src/runtime/symtab.go:1030 +0x1c
    runtime.pcvalue({0x6bd8a8, 0x6ceda0}, 0x488f4, 0x51345d, 0xc000591a38, 0x1)
    	/usr/local/go/src/runtime/symtab.go:834 +0x18a
    runtime.funcspdelta({0x6bd8a8, 0x6ceda0}, 0x0, 0x0)
    	/usr/local/go/src/runtime/symtab.go:957 +0x4d
    runtime.gentraceback(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7fffffff, 0x5c3ec0, 0x0, 0x0)
    	/usr/local/go/src/runtime/traceback.go:207 +0x59d
    runtime.copystack(0xc0000001a0, 0x4000)
    	/usr/local/go/src/runtime/stack.go:918 +0x293
    runtime.newstack()
    	/usr/local/go/src/runtime/stack.go:1097 +0x47b
    runtime.morestack()
    	/usr/local/go/src/runtime/asm_amd64.s:461 +0x8b
    
    goroutine 1 [copystack]:
    runtime.deductSweepCredit(0x2000, 0x0)
    	/usr/local/go/src/runtime/mgcsweep.go:711 +0x145 fp=0xc000546338 sp=0xc000546330 pc=0x422f65
    runtime.(*mcentral).cacheSpan(0x70ea08)
    	/usr/local/go/src/runtime/mcentral.go:82 +0x46 fp=0xc0005463b0 sp=0xc000546338 pc=0x415f86
    runtime.(*mcache).refill(0x7fe6c85ed3c8, 0xb)
    	/usr/local/go/src/runtime/mcache.go:162 +0xaf fp=0xc000546400 sp=0xc0005463b0 pc=0x41580f
    runtime.(*mcache).nextFree(0x7fe6c85ed3c8, 0xb)
    	/usr/local/go/src/runtime/malloc.go:886 +0x85 fp=0xc000546448 sp=0xc000546400 pc=0x40bfc5
    runtime.mallocgc(0x30, 0x0, 0x0)
    	/usr/local/go/src/runtime/malloc.go:1077 +0x4e8 fp=0xc0005464c8 sp=0xc000546448 pc=0x40c648
    runtime.growslice(0x5a04c0, {0x0, 0xc00046a5b8, 0x0}, 0x0)
    	/usr/local/go/src/runtime/slice.go:261 +0x4ac fp=0xc000546530 sp=0xc0005464c8 pc=0x4489ac
    go/printer.(*printer).writeString(0xc000546a00, {{0x0, 0x0}, 0x0, 0x1, 0x1}, {0xc0003272c0, 0x22}, 0x0)
    	/usr/local/go/src/go/printer/printer.go:313 +0x1e5 fp=0xc0005465b0 sp=0xc000546530 pc=0x51b725
    go/printer.(*printer).print(0xc000546a00, {0xc000546778, 0x1, 0xc0003d2600})
    	/usr/local/go/src/go/printer/printer.go:1017 +0x65b fp=0xc0005466d0 sp=0xc0005465b0 pc=0x51db1b
    go/printer.(*printer).expr1(0xc00046aa00, {0x5f11f8, 0xc0002dc020}, 0x0, 0x1)
    	/usr/local/go/src/go/printer/nodes.go:788 +0xcdd fp=0xc0005468f0 sp=0xc0005466d0 pc=0x51345d
    go/printer.(*printer).expr(...)
    	/usr/local/go/src/go/printer/nodes.go:1117
    go/printer.(*printer).printNode(0xc00046aa00, {0x5961e0, 0xc0002dc020})
    	/usr/local/go/src/go/printer/printer.go:1138 +0x375 fp=0xc000546990 sp=0xc0005468f0 pc=0x51e295
    go/printer.(*Config).fprint(0xc00046abe0, {0x5ed740, 0xc0001bc030}, 0x22, {0x5961e0, 0xc0002dc020}, 0xc0001bc000)
    	/usr/local/go/src/go/printer/printer.go:1319 +0x17c fp=0xc000546b98 sp=0xc000546990 pc=0x51ee7c
    go/printer.(*printer).nodeSize(0xc00046b360, {0x5f03d0, 0xc0002dc020}, 0xf4240)
    	/usr/local/go/src/go/printer/nodes.go:1720 +0x134 fp=0xc000546c28 sp=0xc000546b98 pc=0x519154
    go/printer.(*printer).exprList(0xc00046b360, 0xc00046b0f8, {0xc000346000, 0x1, 0x36c0046b068}, 0xf00000013, 0x1, 0xc00046b770, 0x0)
    	/usr/local/go/src/go/printer/nodes.go:213 +0x8c5 fp=0xc000547030 sp=0xc000546c28 pc=0x50f005
    go/printer.(*printer).expr1(0xc00046b360, {0x5f0ef8, 0xc000110000}, 0x0, 0x1)
    	/usr/local/go/src/go/printer/nodes.go:949 +0x1890 fp=0xc000547250 sp=0xc000547030 pc=0x514010
    go/printer.(*printer).expr(...)
    	/usr/local/go/src/go/printer/nodes.go:1117
    go/printer.(*printer).printNode(0xc00046b360, {0x58cfa0, 0xc000110000})
    	/usr/local/go/src/go/printer/printer.go:1138 +0x375 fp=0xc0005472f0 sp=0xc000547250 pc=0x51e295
    go/printer.(*Config).fprint(0xc00046b530, {0x5ed740, 0x6e5580}, 0x5c3d70, {0x58cfa0, 0xc000110000}, 0xc0001bc000)
    	/usr/local/go/src/go/printer/printer.go:1319 +0x17c fp=0xc0005474f8 sp=0xc0005472f0 pc=0x51ee7c
    go/printer.(*Config).Fprint(...)
    	/usr/local/go/src/go/printer/printer.go:1381
    go/printer.Fprint(...)
    	/usr/local/go/src/go/printer/printer.go:1390
    main.gofmt({0x58cfa0, 0xc000110000})
    	/usr/local/go/src/cmd/cgo/godefs.go:123 +0xa5 fp=0xc000547560 sp=0xc0005474f8 pc=0x55b5a5
    main.gofmtLine({0x58cfa0, 0xc000110000})
    	/usr/local/go/src/cmd/cgo/godefs.go:170 +0x25 fp=0xc000547588 sp=0xc000547560 pc=0x55b685
    main.gofmtPos({0x5f0ef8, 0xc000110000}, 0xc00022b820)
    	/usr/local/go/src/cmd/cgo/gcc.go:1540 +0x4e fp=0xc000547680 sp=0xc000547588 pc=0x54d6ae
    main.(*Package).rewriteRef(0xc000144000, 0xc000134dc0)
    	/usr/local/go/src/cmd/cgo/gcc.go:1399 +0x636 fp=0xc000547a60 sp=0xc000547680 pc=0x54bcd6
    main.(*Package).Translate(0xc000144000, 0xc000134dc0)
    	/usr/local/go/src/cmd/cgo/gcc.go:212 +0x3fb fp=0xc000547cd0 sp=0xc000547a60 pc=0x54433b
    main.main()
    	/usr/local/go/src/cmd/cgo/main.go:375 +0x6e5 fp=0xc000547f80 sp=0xc000547cd0 pc=0x55bfc5
    runtime.main()
    	/usr/local/go/src/runtime/proc.go:255 +0x227 fp=0xc000547fe0 sp=0xc000547f80 pc=0x4345e7
    runtime.goexit()
    	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc000547fe8 sp=0xc000547fe0 pc=0x45fdc1

FAIL
FAIL runtime 308.329s
ok runtime/cgo 0.015s
ok runtime/debug 0.189s
ok runtime/internal/atomic 2.970s
ok runtime/internal/math 0.004s
ok runtime/internal/sys 0.067s
ok runtime/metrics 0.079s
ok runtime/pprof 54.341s
? runtime/race [no test files]
ok runtime/trace 14.803s
ok sort 0.702s
ok strconv 1.876s
ok strings 1.406s
ok sync 5.423s
ok sync/atomic 62.616s
ok syscall 0.185s
ok testing 3.597s
ok testing/fstest 0.040s
? testing/internal/testdeps [no test files]
ok testing/iotest 0.091s
ok testing/quick 0.080s
ok text/scanner 0.030s
ok text/tabwriter 0.046s
--- FAIL: TestLinkerGC (1.69s)
link_test.go:50: go build: exit status 2, # command-line-arguments
unexpected fault address 0x7fa404e99200
fatal error: fault
[signal SIGBUS: bus error code=0x2 addr=0x7fa404e99200 pc=0x567692]

    goroutine 1 [running]:
    runtime.throw({0x66cc87, 0xc0000a8000})
    	/usr/local/go/src/runtime/panic.go:1198 +0x71 fp=0xc00011c940 sp=0xc00011c910 pc=0x434291
    runtime.sigpanic()
    	/usr/local/go/src/runtime/signal_unix.go:732 +0x125 fp=0xc00011c990 sp=0xc00011c940 pc=0x44a4e5
    encoding/binary.littleEndian.Uint16(...)
    	/usr/local/go/src/encoding/binary/binary.go:54
    cmd/internal/goobj.(*Reloc).Type(...)
    	/usr/local/go/src/cmd/internal/goobj/objfile.go:386
    cmd/link/internal/loader.Reloc.Weak(...)
    	/usr/local/go/src/cmd/link/internal/loader/loader.go:57
    cmd/link/internal/ld.(*deadcodePass).flood(0xc00011cc38)
    	/usr/local/go/src/cmd/link/internal/ld/deadcode.go:137 +0x4d2 fp=0xc00011cb70 sp=0xc00011c990 pc=0x567692
    cmd/link/internal/ld.deadcode(0xc000160000)
    	/usr/local/go/src/cmd/link/internal/ld/deadcode.go:330 +0x9d fp=0xc00011ccb0 sp=0xc00011cb70 pc=0x5687bd
    cmd/link/internal/ld.Main(_, {0x20, 0x20, 0x1, 0x7, 0x10, 0x0, {0x0, 0x0}, {0x678999, ...}, ...})
    	/usr/local/go/src/cmd/link/internal/ld/main.go:252 +0xdb2 fp=0xc00011cf28 sp=0xc00011ccb0 pc=0x5a9c12
    main.main()
    	/usr/local/go/src/cmd/link/main.go:69 +0x1005 fp=0xc00011df80 sp=0xc00011cf28 pc=0x612fc5
    runtime.main()
    	/usr/local/go/src/runtime/proc.go:255 +0x227 fp=0xc00011dfe0 sp=0xc00011df80 pc=0x436967
    runtime.goexit()
    	/usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc00011dfe8 sp=0xc00011dfe0 pc=0x463c61

FAIL
FAIL text/template 2.251s
ok text/template/parse 0.017s
ok time 9.976s
? time/tzdata [no test files]
ok unicode 0.017s
ok unicode/utf16 0.013s
ok unicode/utf8 0.074s
? unsafe [no test files]
FAIL

More Information

This does not appear to be specific to the go test command or the go executable in general, that just happens to be an easy example to reproduce the problem. The problem is reproducible (to varying degrees of success) with user applications written in go, although so far I have only managed to trigger the signal with (filesystem) I/O intensive applications. That seems to be true regardless of where the other files are located (and what filesystem they are on), so long as the application binary itself is on an AFS volume, as noted in go-hep/hep#885.

I believe this is may be the same problem mentioned in the comment #37310 (comment), which does not appear to have a dedicated issue. This also appears suspiciously similar to an issue with go binaries and gcsfuse, see: #48997. The workaround from the latter issue appears to work here as well: running with GODEBUG=asyncpreemptoff=1 seems to prevent the SIGBUS error from occuring (for both the main go binary or for compiled user applications).

If I had to guess, I would say that this looks like something is being preempted at a point that's unsafe if the binary happens to be on AFS (or apparently gcsfuse), but which turns out to be safe (in practice) on other filesystems. I don't know if that's a Go problem or an AFS (and gcsfuse) problem, but other binaries do not encounter a SIGBUS when running from the same AFS volume (or on gcsfuse, according to that issue), so my initial suspicious is that the problem is on the Go side.

@randall77
Copy link
Contributor

I have the feeling this is just #48997 with a different filesystem.

Go uses a lot more signals than other runtimes, which might account for the fact that other runtimes don't exhibit this problem.

It would be interesting to try to reproduce using a C program that sends itself lots of signals. That might illuminate matters.

@vkuznet
Copy link

vkuznet commented Jan 11, 2022

+1

@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 11, 2022
@DemiMarie
Copy link
Contributor

This looks like a kernel bug. It seems that the kernel is trying to cancel the I/O operation, but you can’t usefully cancel the handling of a page fault!

@gopherbot
Copy link
Contributor

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)

@DemiMarie
Copy link
Contributor

I think this is indeed not a bug in Go, but it is a bug in Linux. As a workaround, could Go register all of its signal handlers with SA_RESTART? That said, this looks like a duplicate of #48997 anyway.

@ianlancetaylor
Copy link
Contributor

Go does already register all signal handlers with SA_RESTART.

@DemiMarie
Copy link
Contributor

That makes this either a kernel bug or an AFS bug, then. Probably the former.

@golang golang locked and limited conversation to collaborators Feb 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

7 participants