You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
PanicInfo implements Display, so we end up with something like:
Panic occurred: panicked at 'Failed to open the API socket: IO Error: Io(Os { code: 98, kind: AddrInUse, message: "Address in use" })', src/main.rs:137:37
instead of:
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 } }
which is already a nice improvement.
To have the inner error message pretty printed we have to also implement Display for those errors (e.g. AddrInUse and Error from vmm/src/lib.rs).
We have a panic hook in Firecracker that is logging the panic info as is:
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:
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:
The text was updated successfully, but these errors were encountered: