-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tokio::run
doesn't propogate panics from futures
#495
Comments
got the same issue. setting panic hook to exit in every test is my workaround: https://doc.rust-lang.org/std/panic/fn.set_hook.html |
@canndrew this is the intent. You might be wanting Closing for now. Let me know if this is incorrect and I can open again. |
Sorry, you're right, I misunderstood what |
@carllerche That's exactly what I want for tests. A configuration for the |
@leodasvacas does |
@carllerche No because it does not compose. If I |
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 |
I'd be fine having a config option passed to |
How about making it so tokio propagates panics in debug mode but not release mode? |
We can probably start w/ a builder option, then decide after that what the defaults should be? |
Yeah, differing behavior in debug and release modes I think is asking for trouble. |
Panics should crash the program. This feature continues to introduce bugs in Deno. (Most recently denoland/deno#2098) |
This is to work around Tokio's panic recovery feautre. tokio-rs/tokio#495 tokio-rs/tokio#209
This is to work around Tokio's panic recovery feautre. Ref tokio-rs/tokio#495 Ref tokio-rs/tokio#209 Ref denoland#1311 Fixes denoland#2097
This is to work around Tokio's panic recovery feature. Ref tokio-rs/tokio#495 Ref tokio-rs/tokio#209 Ref denoland#1311 Fixes denoland#2097
This is to work around Tokio's panic recovery feature. Ref tokio-rs/tokio#495 Ref tokio-rs/tokio#209 Ref denoland#1311 Fixes denoland#2097
This is to work around Tokio's panic recovery feature. Ref tokio-rs/tokio#495 Ref tokio-rs/tokio#209 Ref #1311 Fixes #2097
I will re-open since the action item is to add a config option. I believe the story will be better in 0.2. |
I'd also like to be able to override the global panic behaviour per-task, so that selected tasks (and child tasks) still catch panics. |
Shouldn’t it be the responsibility of user code to catch their panics? I can imagine a web server wanting to serve special html 500 error code pages. At tokio’s layer of abstraction, catching panics isn’t helpful because it doesn’t know how to properly service them. |
I think what I was getting at was more that I would expect the ergonomics to be set up so that the runtime returns a For your webserver example, the main server should propagate any errors upstream terminating the runner, and the client tasks should probably just discard any errors. If you drop every thread panic on the floor, you can wind up with scenarios where your main server thread panics, other spawned tasks run forever, and your program just keeps chugging along unable to service requests. If you insist that every thread panic terminates the runner, then panics in client threads will terminate your server. This is safer, but less ergonomic. Right now there's no way to tell the runner which threads should be treated as detached and which ones should terminate the runtime. I can see an implementation with |
I don't think this issue is relevant anymore:
|
If I am wrong, please post here and I can update the appropriate issue. |
This is to work around Tokio's panic recovery feature. Ref tokio-rs/tokio#495 Ref tokio-rs/tokio#209 Ref denoland/deno#1311 Fixes #2097
@jeff-at-dwelo don't you have issues fuzzing concurrent code anyway? As it might throw the fuzzer off? |
I assumed the following test would fail, but it currently passes.
Is this expected behaviour? It doesn't seem like it should be.
The text was updated successfully, but these errors were encountered: