mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: print fatal messages without interleaving
Grab the print lock around the set of prints we use to report fatal errors. This ensures that each fatal error gets reported atomically instead of interleaved with other fatal errors. Fixes #69447 Change-Id: Ib3569f0c8210fd7e19a7d8ef4bc114f07469f317 Reviewed-on: https://go-review.googlesource.com/c/go/+/615655 Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
parent
b17a55d095
commit
6cb107452a
2 changed files with 29 additions and 3 deletions
|
|
@ -1081,6 +1081,7 @@ func throw(s string) {
|
|||
func fatal(s string) {
|
||||
// Everything fatal does should be recursively nosplit so it
|
||||
// can be called even when it's unsafe to grow the stack.
|
||||
printlock() // Prevent multiple interleaved fatal reports. See issue 69447.
|
||||
systemstack(func() {
|
||||
print("fatal error: ")
|
||||
printindented(s) // logically printpanicval(s), but avoids convTstring write barrier
|
||||
|
|
@ -1088,6 +1089,7 @@ func fatal(s string) {
|
|||
})
|
||||
|
||||
fatalthrow(throwTypeUser)
|
||||
printunlock()
|
||||
}
|
||||
|
||||
// runningPanicDefers is non-zero while running deferred functions for panic.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue