mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-27 18:18:55 +00:00
Closes #3567 This doesn't feel complete, but there isn't much more I can do without changing lots of code and doing more research, and I don't want to hold up the Windows beta for error handling that may not be used. I'm only handling crashes, errors, and panics in the `Controller` task since it's hard to simulate them elsewhere. Everything else like the wintun worker thread will have to be best-effort or tested by modifying the code temporarily. Crashes go to stderr and and the log file, and we can get a line number from the crash dump:  Errors go to stderr and the log file, but we don't get a line number, because we aren't capturing the backtrace:  Panics go to stderr and the log file, but we don't even get the panic message. I don't think I can do much about that. Tokio doesn't give us the full `PanicInfo`, which contains the message and location (line number). If we end up debugging a panic in prod we could bisect by putting tighter bounds until we narrow it down.  The panic hook ends up not triggered because: - If I don't catch the panic, the app won't close, because Tokio will catch the panic - If I do catch the panic, I can't call the panic hook manually, because Tokio doesn't give me a `PanicInfo` struct. And I can't resume the panic, because I'm still inside a Tokio task. I don't think there's any point capturing a crash dump on panic, because Tokio will have already stopped the panicked thread, and the backtrace will only show the catch location. Maybe the message would print if I changed the controller task to a controller thread, so that panicking that thread will trigger `tracing_panic` and then abort the process? But that's a bigger change. --------- Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com> Co-authored-by: Gabi <gabrielalejandro7@gmail.com>