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

tokio::io::copy should yield if it copies too many times #6250

Closed
Darksonn opened this issue Dec 26, 2023 · 3 comments · Fixed by #6265
Closed

tokio::io::copy should yield if it copies too many times #6250

Darksonn opened this issue Dec 26, 2023 · 3 comments · Fixed by #6265
Labels
A-tokio Area: The main tokio crate E-help-wanted Call for participation: Help is requested to fix this issue. M-coop Module: tokio/coop M-io Module: tokio/io

Comments

@Darksonn
Copy link
Contributor

If tokio::io::{copy,copy_bidirectional} are given streams that don't interact with coop and have a lot of data available, then they should yield after copying data some number of times.

One way to do this is to have copy consume a coop budget each time it copies a chunk of data.

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-io Module: tokio/io M-coop Module: tokio/coop E-help-wanted Call for participation: Help is requested to fix this issue. labels Dec 26, 2023
@Rustin170506
Copy link
Contributor

Rustin170506 commented Dec 27, 2023

I am working on this.

@Rustin170506
Copy link
Contributor

@Darksonn Is there any existing code example I can follow? I am not sure what is the right way to do it.

@Darksonn
Copy link
Contributor Author

Darksonn commented Jan 2, 2024

You can look for previous similar PRs. For example #6254. Also check out this search query.

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 E-help-wanted Call for participation: Help is requested to fix this issue. M-coop Module: tokio/coop M-io Module: tokio/io
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants