-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
threadpool: add panic_handler #1052
Conversation
Thanks for opening this PR, and I’m sorry you ran into those issues in Deno! I think this behavior might be better integrated not as a feature flag, but as part of the builder, as a lot of similar configuration is done through there. What do you think? |
@davidbarsky That does sounds better. I've updated the patch add |
@ry Thanks for updating the PR! What makes things somewhat tricky is the pool doesn't exist until
At that point, forwarding the panics to (Unfortunately, I think the “later work” you mentioned has to happen now if this feature is done through a builder, not a compile-time flag.) |
@davidbarsky Ok good idea. PTAL - I've updated the patch to have |
Thanks for the PR. I'm out this week, but I did a quick skim and nothing jumped out. I assigned @stjepang, if it looks good, feel free to merge. Otherwise, I'll take another look next week and handle it 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks!
My only nit is that maybe we should rename catch_panics
to panic_handler
like in Rayon (see here) for consistency.
Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick commit! :) I'm deferring the PR to @carllerche in case he wants to take one final look at it.
Thanks 👍 this should get published to crates.io tomorrow. |
Motivation
tokio-threadpool currently catches panics that happen inside the thread pool. This can cause silent failures.
Solution
This patch adds a feature
no_catch_panic
to tokio-threadpool toresume_unwind()
after the catch happens. This does not actually forward the panics back totokio::run()
, that will be left for later work.Ref #495
#209
denoland/deno#1311
denoland/deno#2097