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

fatal error: found bad pointer in Go heap #66576

Open
Jackey1024 opened this issue Mar 28, 2024 · 4 comments
Open

fatal error: found bad pointer in Go heap #66576

Jackey1024 opened this issue Mar 28, 2024 · 4 comments
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@Jackey1024
Copy link

Go version

go1.21.7 linux/arm64

Output of go env in your module/workspace:

NA

What did you do?

I encountered this fatal error by chance when I compile golang:
./make.bash -v
...
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
runtime
internal/goarch
internal/bytealg
internal/abi
internal/godebugs
internal/coverage/rtcov
internal/cpu
runtime/internal/syscall
runtime/internal/math
internal/goos
runtime/internal/sys
runtime/internal/atomic
internal/goexperiment
runtime: pointer 0xdeaddeaddeaddead
runtime: found in object at *(0xffff5a7e9b98+0x4200)
object=0xffff5a7e9b98 s=nil
fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)
runtime stack:
runtime.dopanic__m
:0
runtime.throw
:0
runtime.badPointer
:0
runtime.findObject
:0
runtime.scanstackblock
:0
doscanstack1
:0
runtime.doscanstack
:0
runtime.markroot..func1
:0
runtime.systemstack
:0
runtime.markroot.constprop.0.isra.0
:0
runtime.gcDrain
:0
runtime.gcBgMarkWorker..func2
:0
runtime.systemstack..func1
:0
runtime_mstart
:0
start_thread
:0
thread_start
:0
:0
goroutine 140 [GC worker (idle)]:
runtime.mcall
:0
runtime.systemstack
:0
runtime.gcBgMarkWorker
:0
runtime.kickoff
:0
__startcontext
:0
goroutine 1 [semacquire]:
runtime.mcall
:0
runtime.gopark
:0
runtime.goparkunlock
:0
runtime.semacquire1
:0
sync.runtime__Semacquire
:0
sync.WaitGroup.Wait

What did you see happen?

fatal error: found bad pointer in Go heap (incorrect use of unsafe or cgo?)

What did you expect to see?

NA

@randall77
Copy link
Contributor

The fact that you found 0xdeaddeaddeaddead is very strange, as that's part of an experiment that isn't enabled by default.
So really, it would help to provide your environment variables to see if you enabled that experiment somehow.
The object address (0xffff....) is also strange, as it doesn't look like a heap address.

Please also add the full printout from the crash. Particularly, what does the line starting with "Building Go cmd/dist using " say?

@randall77 randall77 added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 28, 2024
@thediveo
Copy link

0xffff.... looks more like kernel space?

@Jackey1024
Copy link
Author

The full printout is is in the attachment
build-golang-error-log.txt
go env GO111MODULE="" GOARCH="arm64" GOBIN="" GOCACHE="/builddir/.cache/go-build" GOENV="/builddir/.config/go/env" GOEXE="" GOEXPERIMENT="fieldtrack" GOFLAGS="" GOHOSTARCH="arm64" GOHOSTOS="linux" GOINSECURE="" GOMODCACHE="/builddir/go/pkg/mod" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/builddir/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/libexec/gcc/aarch64-OpenCloudOS-linux/12" GOVCS="" GOVERSION="go1.18 gccgo (Tencent Compiler 12.3.1) 12.3.1 20230912 (OpenCloudOS 12.3.1-2)" GCCGO="/usr/bin/gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/builddir/build/BUILD/go/src/go.mod" GOWORK="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1688530568=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

@randall77
Copy link
Contributor

There are 7 patches to the release applied in that script.
I'm not sure what those are, and probably they are benign, but it would help to eliminate confounding variables if you could disable them.
Your go env listing in the last comment has GOEXPERIMENT="fieldtrack", but the script printout doesn't seem to mention that. How is the go env you listed related to the environment the script uses?

The script says Building Go cmd/dist using /., which makes me think you're somehow using the Go release to bootstrap itself from the same directory. GOROOT_BOOTSTRAP should probably be set to something else, not sure what though, I've never bootstrapped via gccgo before.

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants