diff options
author | bdonlan <bdonlan@gmail.com> | 2020-12-07 20:55:02 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-07 20:55:02 -0800 |
commit | 57dffb9dfe9e4c0f12429246540add3975f4a754 (patch) | |
tree | 1890e495daa058f06c8a738de4c88b0aeea52f77 /stress-test | |
parent | 62023dffe5396ee1a0380f12c7530bf4ff59fe4a (diff) |
rt: fix deadlock in shutdown (#3228)
Previously, the runtime shutdown logic would first-hand control over all cores
to a single thread, which would sequentially shut down all tasks on the core
and then wait for them to complete.
This could deadlock when one task is waiting for a later core's task to
complete. For example, in the newly added test, we have a `block_in_place` task
that is waiting for another task to be dropped. If the latter task adds its
core to the shutdown list later than the former, we end up waiting forever for
the `block_in_place` task to complete.
Additionally, there also was a bug wherein we'd attempt to park on the parker
after shutting it down which was fixed as part of the refactors above.
This change restructures the code to bring all tasks to a halt (and do any
parking needed) before we collapse to a single thread to avoid this deadlock.
There was also an issue in which canceled tasks would not unpark the
originating thread, due to what appears to be some sort of optimization gone
wrong. This has been fixed to be much more conservative in selecting when not
to unpark the source thread (this may be too conservative; please take a look
at the changes to `release()`).
Fixes: #2789
Diffstat (limited to 'stress-test')
0 files changed, 0 insertions, 0 deletions