]> Cypherpunks repositories - gostls13.git/commit
internal/runtime/exithook: make safe for concurrent os.Exit
authorRuss Cox <rsc@golang.org>
Fri, 24 May 2024 13:33:45 +0000 (09:33 -0400)
committerGopher Robot <gobot@golang.org>
Fri, 24 May 2024 16:41:13 +0000 (16:41 +0000)
commitf85c40438fea862be03d2de4b58ed3afe7cfe033
tree199325218768f9bd674f77dcfe9f3312ecff164f
parent378c48df3b485da1ed287f59e5d1f59ad232e554
internal/runtime/exithook: make safe for concurrent os.Exit

Real programs can call os.Exit concurrently from multiple goroutines.
Make internal/runtime/exithook not crash in that case.

The throw on panic also now runs in the deferred context,
so that we will see the full stack trace that led to the panic.
That should give us more visibility into the flaky failures on
bugs #55167 and #56197 as well.

Fixes #67631.

Change-Id: Iefdf71b3a3b52a793ca88d89a9c270eb50ece094
Reviewed-on: https://go-review.googlesource.com/c/go/+/588235
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Russ Cox <rsc@golang.org>
src/go/build/deps_test.go
src/internal/runtime/exithook/hooks.go
src/runtime/ehooks_test.go
src/runtime/proc.go
src/runtime/testdata/testexithooks/testexithooks.go