Skip to content

runtime: fpTraceback fails when trying to take a stack trace of a goroutine in a syscall #66889

Closed
@mknyszek

Description

@mknyszek

After https://go.dev/cl/567076 (for #65634) landed, the runtime began trying to take the frame-pointer-based stack trace of a goroutine in a syscall. Turns out, the runtime had never tried to this before, and it's totally broken.

The main issue is that traceStack tries to use gp.sched.bp but that's not even set when entering a syscall. Worse still, gp.sched in general could get clobbered by calling systemstack. It can then get updated again when switching back to the Go stack (since the syscall path wants to undo the clobbering).

For now, I'm just going to disable getting a stack trace for goroutines blocked in a syscall for the entirety of a generation. To resolve this, what we really need is a gp.syscallbp, akin to gp.syscallpc and gp.syscallsp. The latter two are already used by the regular stack unwinder if available, and they're actually stable, as opposed to gp.sched which gets mutated. Implementing that will be a bigger change, so I'm putting that on the backburner.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions