Forcefully shut down the runtime before existing the main task#3378
Conversation
tevoinea
left a comment
There was a problem hiding this comment.
Just to help me better understand:
- We'll never call
rt.shutdown_background()untillet result = rt.block_on(run(matches));completes run(matches)will only complete when one of the futures complete from thisselect!macroonefuzz/src/agent/onefuzz-task/src/managed/cmd.rs
Lines 101 to 114 in bcf3cf9
select!claims to cancel the remaining branches
Waits on multiple concurrent branches, returning when the first branch completes, cancelling the remaining branches.
Does that mean the cancellation from select! happens in the background? And that prior to this PR, we wait for the cancellation to complete when we drop the runtime?
This is not necessarily a problem with |
Summary of the Pull Request
The default behavior or the runtime is wait for all spawned work to be done before exiting. This was causing the task to hang when exiting.
This change adds a force shutdown at the end of the main function of the task.
closes #3377