]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: differentiate "user" and "system" throws
authorMichael Pratt <mpratt@google.com>
Fri, 4 Mar 2022 18:24:04 +0000 (13:24 -0500)
committerMichael Pratt <mpratt@google.com>
Thu, 28 Apr 2022 16:50:31 +0000 (16:50 +0000)
commit29bbca5c2c1ad41b2a9747890d183b6dd3a4ace4
tree74ea0c8d0bed2673984f9c0767c40ace72fc0bb2
parent4bb45f7549548add8222aa4f3040d0e2120691a9
runtime: differentiate "user" and "system" throws

"User" throws are throws due to some invariant broken by the application.
"System" throws are due to some invariant broken by the runtime,
environment, etc (i.e., not the fault of the application).

This CL sends "user" throws through the new fatal. Currently this
function is identical to throw, but with a different name to clearly
differentiate the throw type in the stack trace, and hopefully be a bit
more clear to users what it means.

This CL changes a few categories of throw to fatal:

1. Concurrent map read/write.
2. Deadlock detection.
3. Unlock of unlocked sync.Mutex.
4. Inconsistent results from syscall.AllThreadsSyscall.

"Thread exhaustion" and "out of memory" (usually address space full)
throws are additional throws that are arguably the fault of user code,
but I've left off for now because there is no specific invariant that
they have broken to get into these states.

For #51485

Change-Id: I713276a6c290fd34a6563e6e9ef378669d74ae32
Reviewed-on: https://go-review.googlesource.com/c/go/+/390420
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
src/runtime/HACKING.md
src/runtime/map.go
src/runtime/map_fast32.go
src/runtime/map_fast64.go
src/runtime/map_faststr.go
src/runtime/os_linux.go
src/runtime/panic.go
src/runtime/proc.go
src/sync/mutex.go
src/sync/rwmutex.go