]> Cypherpunks repositories - gostls13.git/commit
runtime: use the correct M ID for syscalling goroutines in traces
authorMichael Anthony Knyszek <mknyszek@google.com>
Mon, 22 Jan 2024 16:34:41 +0000 (16:34 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 22 Jan 2024 21:47:43 +0000 (21:47 +0000)
commitc46966653f6144e20f8b9bccb96e7a7f1d32aeb9
tree31fa63d9b25110a7973c7e16b4edb6bca4782c12
parentb7ae16e04b93c771dca22f7a9b3d6f985027b101
runtime: use the correct M ID for syscalling goroutines in traces

Earlier in the development of the new tracer, m.id was used as a the
canonical ID for threads. Later, we switched to m.procid because it
matches the underlying OS resource. However, in that switch, we missed a
spot.

The tracer catches and emits statuses for goroutines that have remained
in either waiting or syscall across a whole generation, and emits a
thread ID for the latter set. The ID being used here, however, was m.id
instead of m.procid, like the rest of the tracer.

This CL also adds a regression test. In order to make the regression
test actually catch the failure, we also have to make the parser a
little less lenient about GoStatus events with GoSyscall: if this isn't
the first generation, then we should've seen the goroutine bound to an
M already when its status is getting emitted for its context. If we emit
the wrong ID, then we'll catch the issue when we emit the right ID when
the goroutine exits the syscall.

Fixes #65196.

Change-Id: I78b64fbea65308de5e1291c478a082a732a8bf9f
Reviewed-on: https://go-review.googlesource.com/c/go/+/557456
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/internal/trace/v2/order.go
src/internal/trace/v2/testdata/testprog/wait-on-pipe.go [new file with mode: 0644]
src/internal/trace/v2/trace_test.go
src/runtime/trace2.go