Skip to content
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

Make sure coop system never consumes permits without actually performing work #3502

Closed
Darksonn opened this issue Feb 3, 2021 · 2 comments
Closed
Labels
A-tokio Area: The main tokio crate I-hang Program never terminates, resulting from infinite loops, deadlock, livelock, etc. M-coop Module: tokio/coop

Comments

@Darksonn
Copy link
Contributor

Darksonn commented Feb 3, 2021

As initially described in #3493 (comment), it is noted that if the coop system consumes a permit without doing any work, this can cause a deadlock.

One instance of this is found here:

let coop = ready!(crate::coop::poll_proceed(cx));
me.entry.poll_elapsed(cx).map(move |r| {
coop.made_progress();
r
})

This issue tracks finding all such instances, and should not be closed until we are confident that we have fixed all of them.

@Darksonn Darksonn added A-tokio Area: The main tokio crate I-hang Program never terminates, resulting from infinite loops, deadlock, livelock, etc. M-coop Module: tokio/coop labels Feb 3, 2021
@jonhoo
Copy link
Sponsor Contributor

jonhoo commented Feb 4, 2021

I'm not sure I follow why the indicated code is buggy? The point of the call to made_progress inside of map is to make it so that if progress isn't made, the budget is not consumed. That is, if coop is dropped without made_progress being called, the budget is restored to what it was prior to the call to poll_proceed. So that code looks right to me.

@Darksonn
Copy link
Contributor Author

Darksonn commented Jul 5, 2021

I agree. I think the implementation is right.

@Darksonn Darksonn closed this as completed Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate I-hang Program never terminates, resulting from infinite loops, deadlock, livelock, etc. M-coop Module: tokio/coop
Projects
None yet
Development

No branches or pull requests

2 participants