[go] runtime: allow Stack to traceback goroutines in syscall _Grunning window

4 views
Skip to first unread message

Michael Knyszek (Gerrit)

unread,
Oct 30, 2025, 4:32:55 PM (7 days ago) Oct 30
to goph...@pubsubhelper.golang.org, Michael Pratt, golang-co...@googlegroups.com
Attention needed from Michael Pratt

Michael Knyszek voted

Auto-Submit+1
Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Michael Pratt
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ie6f4b0661d9f8df02c9b8434e99bc95f26fe5f0d
Gerrit-Change-Number: 716680
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Attention: Michael Pratt <mpr...@google.com>
Gerrit-Comment-Date: Thu, 30 Oct 2025 20:32:50 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Michael Pratt (Gerrit)

unread,
Nov 3, 2025, 5:09:10 PM (3 days ago) Nov 3
to Michael Knyszek, goph...@pubsubhelper.golang.org, Michael Pratt, Go LUCI, golang-co...@googlegroups.com
Attention needed from Michael Knyszek

Michael Pratt voted Code-Review+2

Code-Review+2
Open in Gerrit

Related details

Attention is currently required from:
  • Michael Knyszek
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ie6f4b0661d9f8df02c9b8434e99bc95f26fe5f0d
Gerrit-Change-Number: 716680
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Attention: Michael Knyszek <mkny...@google.com>
Gerrit-Comment-Date: Mon, 03 Nov 2025 22:09:07 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Michael Knyszek (Gerrit)

unread,
Nov 3, 2025, 5:39:00 PM (3 days ago) Nov 3
to goph...@pubsubhelper.golang.org, Michael Pratt, Go LUCI, golang-co...@googlegroups.com

Michael Knyszek voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ie6f4b0661d9f8df02c9b8434e99bc95f26fe5f0d
Gerrit-Change-Number: 716680
Gerrit-PatchSet: 2
Gerrit-Owner: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Knyszek <mkny...@google.com>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Comment-Date: Mon, 03 Nov 2025 22:38:57 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Michael Knyszek (Gerrit)

unread,
Nov 3, 2025, 5:54:17 PM (3 days ago) Nov 3
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Michael Pratt, golang-co...@googlegroups.com

Michael Knyszek submitted the change

Change information

Commit message:
runtime: allow Stack to traceback goroutines in syscall _Grunning window

net/http/cgi.TestCopyError calls runtime.Stack to take a stack trace of
all goroutines, and searches for a specific line in that stack trace.

It currently sometimes fails because it encounters the goroutine its
looking for in the small window where a goroutine might be in _Grunning
while in a syscall, introduced in CL 646198. In that case, the traceback
will give up, failing to print the stack TestCopyError is expecting.

This represents a general regression, since previously runtime.Stack
could never fail to take a goroutine's stack; giving up was only
possible in fatal panic cases.

Fix this the same way we fixed goroutine profiles: allow the stack trace
to proceed if the g's syscallsp != 0. This is safe in any
stop-the-world-related context, because syscallsp won't be mutated while
the goroutine fails to acquire a P, and thus fails to fully exit the
syscall context. This also means the stack below syscallsp won't be
mutated, and thus taking a traceback is also safe.

Fixes #66639.
Change-Id: Ie6f4b0661d9f8df02c9b8434e99bc95f26fe5f0d
Reviewed-by: Michael Pratt <mpr...@google.com>
Files:
  • M src/runtime/traceback.go
Change size: S
Delta: 1 file changed, 10 insertions(+), 1 deletion(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Michael Pratt
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ie6f4b0661d9f8df02c9b8434e99bc95f26fe5f0d
Gerrit-Change-Number: 716680
Gerrit-PatchSet: 3
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages