Replies: 2 comments
-
Work stealing relies on the non-idle threads making progress in some cases. |
Beta Was this translation helpful? Give feedback.
0 replies
-
The consistency in repros ask you use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Not sure if tokio should guarantee this, or if its out of the contract, but...
If I spawn
X
task on a multi-threaded runtime withX
worker threads, I would expect that allX
of these tasks to be picked up and ran in parallel by the next available worker. That would mean that if theX
tasks blocked these worker threads, and guarantee there is no additionalspawn
s of any sort, eventually I would end up with allX
tasks being ran by worker threads and hence blocked.So, a verification of this can be done by using a sync
Barrier
ofX
.Now this all works fine, until I add a
yield_now
to the spawned task.With the yield_now, occasionally, a spawned task will fail to wake up despite the worker threads being idle (verified via thread dump). The repro isn't consistent, so it seems like there's some race in the tokio worker scheduling.
See playground.
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=64b6294b763d600d897b72cefebf8b41
May take a few reruns to get a deadlock and hence a timeout.
Beta Was this translation helpful? Give feedback.
All reactions