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

max_blocking_threads documentation should perhaps indicate that Tokio internally uses those too #5777

Closed
krallin opened this issue Jun 8, 2023 · 1 comment · Fixed by #5793
Labels
A-tokio Area: The main tokio crate C-bug Category: This is a bug. M-runtime Module: tokio/runtime T-docs Topic: documentation

Comments

@krallin
Copy link
Contributor

krallin commented Jun 8, 2023

Version

1.25.0

Platform

Windows, any version

Description

As written, the documentation for max_blocking_threads suggests it's only used for

This probably warrants a small disclaimer that setting this low-ish may be a good idea. In particular, on Windows, reading a pipe is a blocking read and will take away a blocking thread forever.

If you set max_blocking_threads to a low value (e.g. in our case, in a test, we were setting it to 2), you can easily find yourself in a situation where spawn_blocking just hangs forever, because all your blocking threads are waiting on a pair of idle pipes (stdout and stderr of a child process, in our case), which might be rather unexpected!

@krallin krallin added A-tokio Area: The main tokio crate C-bug Category: This is a bug. labels Jun 8, 2023
@Darksonn Darksonn added T-docs Topic: documentation M-runtime Module: tokio/runtime labels Jun 8, 2023
@Darksonn
Copy link
Contributor

Darksonn commented Jun 8, 2023

Sure, adding that makes sense to me.

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 C-bug Category: This is a bug. M-runtime Module: tokio/runtime T-docs Topic: documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants