Skip to content

runtime: garbage collector panic #77317

Description

@pgimalac

Go version

1.24.9 to 1.25.5

Output of go env in your module/workspace:

- OS: Linux
- Architecture: amd64 and arm64
- Environment: containerized (k8s)
- All kinds of large instance types on various cloud providers: c2d-standard-56, n2d-standard-32, standard_d32as_v5, c7g.12xlarge, m7g.16xlarge

What did you do?

A Go service is hitting a garbage collector panic in internal deployments.

runtime: full=0x600467c8000067 next=1153 jobs=1144 nDataRoots=2 nBSSRoots=22 nSpanRoots=64 nStackRoots=1053 spanq.n=0
panic: non-empty mark queue after concurrent mark
fatal error: panic on system stack

I know that it was already happening when we used Go 1.24.9, and it is still happening with 1.25.5. I don't have older logs available so I don't know when it actually started.

I don't have a reproducible example but it's happening 10~20 times a day across our prod environment, and I can deploy a custom version / build with a custom Go if needed to collect information.

I checked all Go memstats metrics and some host metrics of an occurence and didn't see anything remarkable, it was not that close to the memory limits, not allocating that much, not using a lot of CPU, etc.

I'm pretty sure we don't set GOMEMLIMIT, we set GOGC to 50, and one occurence had GOMAXPROCS set to 21 (but that can vary a lot depending on the host).

If it changes anything the service is privileged and uses eBPF for system monitoring. The entrypoint is defined here, but it's not a trivial binary.

What did you see happen?

Here is the start of a stack trace of an occurrence, I can share the full stack trace if it's useful.

Stacktrace
runtime: full=0x600467c8000067 next=1153 jobs=1144 nDataRoots=2 nBSSRoots=22 nSpanRoots=64 nStackRoots=1053 spanq.n=0
panic: non-empty mark queue after concurrent mark
fatal error: panic on system stack
runtime stack:
runtime.throw({0x2890e61?, 0x2c8be90?})
	runtime/panic.go:1094 +0x48 fp=0x74aa367fbba0 sp=0x74aa367fbb70 pc=0x48b008
panic({0x22eac60?, 0x2c8be90?})
	runtime/panic.go:747 +0x33b fp=0x74aa367fbc50 sp=0x74aa367fbba0 pc=0x48addb
runtime.gcMark(0x4956cd?)
	runtime/mgc.go:1633 +0x409 fp=0x74aa367fbcc8 sp=0x74aa367fbc50 pc=0x4327a9
runtime.gcMarkTermination.func1()
	runtime/mgc.go:1059 +0x17 fp=0x74aa367fbce0 sp=0x74aa367fbcc8 pc=0x431b57
runtime.systemstack(0x800000)
	runtime/asm_amd64.s:513 +0x4a fp=0x74aa367fbcf0 sp=0x74aa367fbce0 pc=0x491d0a
goroutine 29 gp=0xc0003936c0 m=71 mp=0xc004181808 [garbage collection]:
runtime.systemstack_switch()
	runtime/asm_amd64.s:478 +0x8 fp=0xc003f1fa28 sp=0xc003f1fa18 pc=0x491ca8
runtime.gcMarkTermination({0x1?, 0x12401ba40c627?, 0x12401ba411b63?, 0x2f6b3?})
	runtime/mgc.go:1058 +0x135 fp=0xc003f1fe98 sp=0xc003f1fa28 pc=0x430a35
runtime.gcMarkDone()
	runtime/mgc.go:1032 +0x369 fp=0xc003f1ff38 sp=0xc003f1fe98 pc=0x4306a9
runtime.gcBgMarkWorker(0xc000066930)
	runtime/mgc.go:1600 +0x345 fp=0xc003f1ffc8 sp=0xc003f1ff38 pc=0x432085
runtime.gcBgMarkStartWorkers.gowrap1()
	runtime/mgc.go:1373 +0x25 fp=0xc003f1ffe0 sp=0xc003f1ffc8 pc=0x431d05
runtime.goexit({})
	runtime/asm_amd64.s:1693 +0x1 fp=0xc003f1ffe8 sp=0xc003f1ffe0 pc=0x493cc1
created by runtime.gcBgMarkStartWorkers in goroutine 1
	runtime/mgc.go:1373 +0x105

What did you expect to see?

The garbage collector should complete without panicking.

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions