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: index out of range panic, runtime.heapBitsForAddr #46728

Closed
xinxindu opened this issue Jun 13, 2021 · 3 comments
Closed

runtime: index out of range panic, runtime.heapBitsForAddr #46728

xinxindu opened this issue Jun 13, 2021 · 3 comments

Comments

@xinxindu
Copy link

@xinxindu xinxindu commented Jun 13, 2021

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

$ go version
go version go1.15.12 linux/amd64

Does this issue reproduce with the latest release?

No

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/root/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
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/go-build923979093=/tmp/go-build -gno-record-gcc-switches"

What did you do?

fatal error: index out of range

runtime stack:
runtime.throw(0x100d065, 0x12)
/usr/local/go/src/runtime/panic.go:1116 +0x72
runtime.panicCheck1(0x423e55, 0x100d065, 0x12)
/usr/local/go/src/runtime/panic.go:34 +0xdd
runtime.goPanicIndexU(0x3080200000, 0x400000)
/usr/local/go/src/runtime/panic.go:91 +0x45
runtime.heapBitsForAddr(...)
/usr/local/go/src/runtime/mbitmap.go:340
runtime.scanobject(0xc200000000000000, 0xc00008ee98)
/usr/local/go/src/runtime/mgcmark.go:1306 +0x3b5
runtime.gcDrain(0xc00008ee98, 0x7)
/usr/local/go/src/runtime/mgcmark.go:1143 +0x22b
runtime.gcBgMarkWorker.func2()
/usr/local/go/src/runtime/mgc.go:1981 +0x177
runtime.systemstack(0x0)
/usr/local/go/src/runtime/asm_amd64.s:370 +0x66
runtime.mstart()
/usr/local/go/src/runtime/proc.go:1116

goroutine 69 [GC worker (idle)]:
runtime.systemstack_switch()
/usr/local/go/src/runtime/asm_amd64.s:330 fp=0xc000221f60 sp=0xc000221f58 pc=0x4708e0
runtime.gcBgMarkWorker(0xc00008d800)
/usr/local/go/src/runtime/mgc.go:1945 +0x1be fp=0xc000221fd8 sp=0xc000221f60 pc=0x41fffe
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1374 +0x1 fp=0xc000221fe0 sp=0xc000221fd8 pc=0x4726c1
created by runtime.gcBgMarkStartWorkers
/usr/local/go/src/runtime/mgc.go:1839 +0x77

What did you expect to see?

please help resolve panic

What did you see instead?

Panic after the program runs for a period of time

@ALTree
Copy link
Member

@ALTree ALTree commented Jun 13, 2021

This won't be easy to investigate without a reproducer. Can you provide a (possibly short, auto-contained) one?

Also, usual questions:

  • Does your program use unsafe? What about cgo?
  • Does it print any warning when run with the race detector enabled? -race?

Loading

@ALTree ALTree changed the title index out of range panic, runtime.heapBitsForAddr runtime: index out of range panic, runtime.heapBitsForAddr Jun 13, 2021
@xinxindu
Copy link
Author

@xinxindu xinxindu commented Jun 16, 2021

Does your program use unsafe? What about cgo?
I used unsafe and cgo. I will remove the unsafe call and pressure test cgo.
Does it print any warning when run with the race detector enabled? -race?
I found many print places with the race detector enabled. I will fix these places.

I will try first, thanks

Loading

@ALTree
Copy link
Member

@ALTree ALTree commented Jun 16, 2021

Thanks. As you know a program containing data races is not a valid Go program, and it's very very likely that this crash is caused by these data races (they can corrupt internal runtime structure). I'm closing here for now, but feel free to comment if you can still reproduce the crasher after fixing the program.

Loading

@ALTree ALTree closed this Jun 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants