Repository navigation
runtime: panic before malloc heap initialized on plan9/amd64 #74006
Copy link
Copy link
Closed
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Description
Go version
go version go1.24.3 plan9/386
Output of go env in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='0'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GO386='sse2'
GOARCH='386'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/usr/glenda/lib/cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/usr/glenda/lib/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m32 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build318083811=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='386'
GOHOSTOS='plan9'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/usr/glenda/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='plan9'
GOPATH='/usr/glenda/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/n/9p-go/386-1.24.3'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/usr/glenda/lib/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/n/9p-go/386-1.24.3/pkg/tool/plan9_386'
GOVCS=''
GOVERSION='go1.24.3'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
I compiled a simple Hello World from an plan9/386 host for a plan9/amd64 (nightly 9front/amd64) target but got an strange error.
I tried the same from a linux/amd64 host, it was the same.
package main
import "fmt"
func main(){
fmt.Println("Hello, World!")
}GOOS=plan9 GOARCH=amd64 go build -o hello hello.goWhat did you see happen?
I got this error
M structure uses sizeclass 1792/0x700 bytes; incompatible with mutex flag mask 0x3ff
fatal error: runtime.m memory alignment too small for spinbit mutex
runtime: panic before malloc heap initialized
runtime stack:
runtime.throw({0x2afac1?, 0x0?})
/usr/lib/go/src/runtime/panic.go:1101 +0x49 fp=0x7fffffffeec8 sp=0x7fffffffee98 pc=0x262309
runtime.lockVerifyMSize()
/usr/lib/go/src/runtime/lock_spinbit.go:97 +0xc5 fp=0x7fffffffeef0 sp=0x7fffffffeec8 pc=0x20fa85
runtime.schedinit()
/usr/lib/go/src/runtime/proc.go:818 +0x34 fp=0x7fffffffef50 sp=0x7fffffffeef0 pc=0x2393d4
runtime.rt0_go()
/usr/lib/go/src/runtime/asm_amd64.s:349 +0x128 fp=0x7fffffffef58 sp=0x7fffffffef50 pc=0x2665c8
What did you expect to see?
Hello, World!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.WaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.Issue is not actionable because of missing required information, which needs to be provided.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Activity
[-]A simple Hello World fails for OS-Plan9/amd64 kernel[/-][+]cmd/compile: compilation fails on plan9/amd64[/+]cagedmantis commentedon Jun 5, 2025
@golang/plan9
[-]cmd/compile: compilation fails on plan9/amd64[/-][+]runtime: panic before malloc heap initialized on plan9/amd64[/+]cuonglm commentedon Jun 5, 2025
cc @golang/runtime
sctaw commentedon Jun 5, 2025
the problem didn't exist in go1.23.9
cuonglm commentedon Jun 5, 2025
Possible culprit: https://go-review.googlesource.com/c/go/+/621715
cc @cherrymui
cherrymui commentedon Jun 5, 2025
This particular error message is from http://go.dev/cl/620435 . It suggests that the size of
runtime.mtype has an unexpected size. The padding code has been rewritten in https://go.dev/cl/654595 , which is included at tip and will be in Go 1.25, but not in Go 1.24. Could you try if this issue is resolved at tip? Thanks.(The plan9/amd64 builder doesn't seem working, so we cannot try it ourselves.)
sctaw commentedon Jun 5, 2025
building tip, brb.
rhysh commentedon Jun 5, 2025
With Go 1.24, you can revert to the previous runtime.mutex implementation (which doesn't require special alignment for the M structure) by building with
GOEXPERIMENT=nospinbitmutex. That should fix thefatal error: runtime.m memory alignment too small for spinbit mutexproblem.Yes, looks like the plan9/amd64 builder is/was offline.
sctaw commentedon Jun 5, 2025
The issue was resolved in tip and nightly 9front. an older qemu machine still gave a sys:suicide error. maybe updating builders to nightly will bring them back.
prattmic commentedon Jun 5, 2025
I believe that the floating point issue is related to a kernel fix that @rsc sent for plan9 (see https://tailscale.com/blog/plan9-port#sse). That allowed us to drop some workarounds in Go (https://go.dev/cl/655875).
@rsc @golang/plan9 does https://go.dev/wiki/Plan9 need an update on minimum requirements?