Closed
Description
We have a panic hook in Firecracker that is logging the panic info as is:
panic::set_hook(Box::new(move |info| {
error!("Panic occurred: {:?}", info);
....
This results in ugly printed messages, that cause confusion about the error that generated the panic.
For example, when the API socket is already in used, we would get an error message as follows:
2019-01-10T16:23:27.009840936 [anonymous-instance:ERROR:src/main.rs:50] Panic occurred: PanicInfo { payload: Any, message: Some(Failed to open the API socket: IO Error: Io(Os { code: 98, kind: AddrInUse, message: "Address in use" })), location: Location { file: "src/main.rs", line: 137, col: 37 } }
We should use the information from the panic info (PanicInfo
structure) and log a human readable error.
The problem is that right now the panic info message (which contains the error that generated the panic) is only available in rust nightly builds.
I am not sure when/if the message
function will be in rust-stable and it might be worth investigating if we can use the human_panic crate.
Example of a pretty-print:
Panic occurred. Error message: API Socket already in use.
The Panic occurred in the "src/main.rs" file at line 137, column 37.
Metadata
Metadata
Assignees
Labels
No labels