3 ms·
Recover() has its sharp edges. If some downstream function part of the execution stack does not release a critical resource because its execution was halted mid
by ignoramous 1y ago
Recover() has its sharp edges. If some downstream function part of the execution stack does not release a critical resource because its execution was halted midway by the bubbling panic, then the resource will leak (and in the case of a locked sync.Mutex, subsequent Lock()s will deadlock).
Until go1.23 [0], Recover() comes in handy for fault reports, however; ex: https://github.com/hashicorp/terraform/blob/325d18262e/internal/logging/panic.go#L36-L64 https://github.com/hashicorp/terraform/blob/325d18262e/inter...
[0] which introduced debug.SetCrashOutput: https://pkg.go.dev/runtime/debug#SetCrashOutput https://pkg.go.dev/runtime/debug#SetCrashOutput