komorebi icon indicating copy to clipboard operation
komorebi copied to clipboard

[BUG][CODE] remove the panic hook / ensure that it shuts down / restarts the process

Open raggi opened this issue 1 year ago • 0 comments

The panic hook is nice in that it might allow for a log entry on panic. The problem is that the reliability of this is unpredictable, because panic hooks in general are hard to make safe/sound.

It's very unsafe/unsound in almost all cases for the process to keep going after a panic, as it's possible that a panic happening can allow objects to be in a state that violates safety rules, at which point we're working from some kind of corrupt state.

In the somewhat more common case, panics will abort threads, as an example I just caught such a case which terminates the command processing thread:

2024-04-14T04:20:00.276914Z ERROR process_command{ToggleMonocle}:toggle_monocle:monocle_off: komorebi: panicked at komorebi\src\workspace.rs:998:26:
attempt to subtract with overflow panic.file="komorebi\\src\\workspace.rs" panic.line=998 panic.column=26

We should ensure that the process exits after a panic happens. We could choose to restart the process in some way, or not to, but continuing is likely to perpetuate some really tricky to track down issues.

raggi avatar Apr 14 '24 04:04 raggi