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

stream::ForEach can no longer block indefinitely #2224

Closed
wants to merge 2 commits into from

Conversation

Lucretiel
Copy link
Contributor

This PR removes the loop from stream::ForEach. Instead, the future
makes at most 1 attempt to poll its interior, and if it can make more
progress, it immediately calls wake_by_ref(), then returns Pending.
In this way, under a fair executor, it can't accidentally starve the
task queue.

This PR removes the `loop` from `stream::ForEach`. Instead, the future
makes at most 1 attempt to poll its interior, and if it can make more
progress, it immediately calls `wake_by_ref()`, then returns Pending.
In this way, under a fair executor, it can't accidentally starve the
task queue.
@cramertj
Copy link
Member

cramertj commented Oct 6, 2020

I'm skeptical of this approach-- see my the related discussion between myself, @jonhoo , and @carllerche in this thread: #2049 (comment)

I also anticipate that this PR would have significant negative performance implications if we adopted this approach throughout the ecosystem: yielding back up to the top-level executor with every step seems like it would interact poorly with locality, and could be very inefficient depending on the top-level executor's queuing implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants