-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix crash blocking inside tokio. Fixes #1017 #2239
base: master
Are you sure you want to change the base?
Fix crash blocking inside tokio. Fixes #1017 #2239
Conversation
…nto fix-crash-blocking-inside-tokio Fix formatting
c80e77a
to
92f99ed
Compare
Hello, please, could you allow the CI to run? |
Hello. Any comments? |
Ping |
Thanks for the PR! However, this is currently by design. Blocking inside a task, even with |
I followed the advice from tokio-rs/tokio#5843 . It looks like it works correctly provided that one is using the multithreaded runtime. There are a number of cases where this is useful. For instance, one has a codebase of synchronous code, and wants to call it from an synchronous context, and converting the code does not pay off (because the web requests are really the only activity at this time). Notice the confusing behavior, when one calls a library function from an asynchronous context, and gets a crash because some part of that library makes a web request. What unexpected consequences could have blocking code inside block_in_place and block_on? |
This pull request makes it possible to run blocking requests inside Tokio runtime without crashing.
This should fix issue #1017