-
Notifications
You must be signed in to change notification settings - Fork 135
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
Shutdown runtime after task is completed #331
Conversation
with this i am receiving these errors 20200213 00:14:35.309 ERROR grin_util::logger - Thread 'tokio-runtime-worker-0' panicked with message: |
Hmm, I'll investigate tomorrow |
@fentanyluser Should be fixed now, I tested the owner api and it no longer panics with latest commit in this PR. The original issue should also be fixed since we wait for shutdown of runtime before returning. |
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.
LGTM, test failures unrelated so merging.
Getting a EDIT: Ignore me - I thought I was running the latest stable rustc but in fact it was quite old. My apologies |
Which version of rust are you using? @aleqx I'm not getting this on 1.41. |
It appears to be still having the same issue #330 |
* Use current thread for tokio runtime * Use single thread runtime with shutdown
Each request was spawning its own multithreaded runtime that kept running even after the request was done, taking up resources unnecessarily. This PR addresses that, by using a runtime that runs in the current thread.
Ideally we would have a single multithreaded runtime to spawn all requests on, but that is a larger refactor that I'm planning on doing later on.
Small side note is that the current-thread runtime is only active until the future completes and any unfinished tasks that were spawned by this future aren't polled anymore. Since we are not spawning any tasks that outlive our future this shouldn't have any effect but it is something to keep in the back of our minds.
Fixes #330