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

Closed
opened 2026-01-05 14:49:50 +01:00 by adam · 0 comments
Owner

Originally created by @raggi on GitHub (Apr 14, 2024).

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.

Originally created by @raggi on GitHub (Apr 14, 2024). 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.
adam added the bug label 2026-01-05 14:49:50 +01:00
adam closed this issue 2026-01-05 14:49:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#337