tokio: `tokio::run` doesn't propogate panics from futures
I assumed the following test would fail, but it currently passes.
#[test]
fn my_test() {
tokio::run(future::lazy(|| -> Result<_, _> {
panic!("oh no!")
}))
}
Is this expected behaviour? It doesn’t seem like it should be.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- Fix silent error and add custom panic handler again This is to work around Tokio's panic recovery feautre. https://github.com/tokio-rs/tokio/issues/495 https://github.com/tokio-rs/tokio/issues/209 — committed to ry/deno by ry 5 years ago
- Fix silent error and add custom panic handler again This is to work around Tokio's panic recovery feautre. Ref https://github.com/tokio-rs/tokio/issues/495 Ref https://github.com/tokio-rs/tokio/issue... — committed to ry/deno by ry 5 years ago
- Fix silent error, add custom panic handler This is to work around Tokio's panic recovery feature. Ref https://github.com/tokio-rs/tokio/issues/495 Ref https://github.com/tokio-rs/tokio/issues/209 Ref... — committed to ry/deno by ry 5 years ago
- Fix silent error, add custom panic handler This is to work around Tokio's panic recovery feature. Ref https://github.com/tokio-rs/tokio/issues/495 Ref https://github.com/tokio-rs/tokio/issues/209 Ref... — committed to ry/deno by ry 5 years ago
- Fix silent error, add custom panic handler (#2098) This is to work around Tokio's panic recovery feature. Ref https://github.com/tokio-rs/tokio/issues/495 Ref https://github.com/tokio-rs/tokio/issu... — committed to denoland/deno by ry 5 years ago
- Fix silent error, add custom panic handler (#2098) This is to work around Tokio's panic recovery feature. Ref https://github.com/tokio-rs/tokio/issues/495 Ref https://github.com/tokio-rs/tokio/issu... — committed to Tzikas/squares by Tzikas 5 years ago
I hate to drag back open an old issue, but this is still a problem. I can’t find a way to reliably capture threadpool panics in tests. I have a codebase liberally using
tokio::spawnthat I’m in the middle of fuzzing, and certain inputs cause those spawned futures to error or panic. From the standpoint oftokio::spawnthere appears to be no behavioral difference between a passed Future returning an err or an ok. I guess this is like being unable to react to panics in a detached thread? What’s the joinable thread alternative, and is it documented somewhere I’m not seeing?