-
While it's clear that tokio will catch panics on polls, it has different policies for panics on drops. tokio/tokio/src/runtime/task/harness.rs Lines 292 to 298 in 4eed411 If panic happens during dropping the handle, tokio won't ignore it: tokio/tokio/src/runtime/task/harness.rs Lines 190 to 192 in 4eed411 If panic happens during cancellation, tokio will catch it: tokio/tokio/src/runtime/task/harness.rs Lines 431 to 433 in 4eed411 If panic happens after a panic during polling, tokio won't catch it and thus causes a double panic: tokio/tokio/src/runtime/task/harness.rs Lines 453 to 459 in 4eed411 Should we have a consistent policy for panics? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
One of these is a bug, which I filed here: #4412. The rest are consistent behavior — the panic is passed on to the |
Beta Was this translation helpful? Give feedback.
One of these is a bug, which I filed here: #4412. The rest are consistent behavior — the panic is passed on to the
JoinHandle
and the user can retrieve it by polling theJoinHandle
. If theJoinHandle
is dropped, then the panic is lost. (The panic handler will still print it to stdout.)