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

Zero pool size in tokio_threadpool::builder::Builder::new() #400

Closed
operutka opened this issue Jun 8, 2018 · 1 comment
Closed

Zero pool size in tokio_threadpool::builder::Builder::new() #400

operutka opened this issue Jun 8, 2018 · 1 comment

Comments

@operutka
Copy link

operutka commented Jun 8, 2018

Hi everyone,

I've discovered a strange behaviour on mipsel-unknown-linux-gnu. It seems like the num_cpus::get() can return zero in some cases. IMHO the threadpool builder should check this to avoid creating a pool with zero worker threads.

@carllerche
Copy link
Member

That is interesting! Could you file an issue on num_cpus and submit a PR here that does cmp::max(1, num_cpus::get())?

facebook-github-bot pushed a commit to facebookarchive/mononoke that referenced this issue Jan 8, 2020
…e from CLI

Summary:
The default behavior of `tokio::runtime::Runtime` is to use the number of CPUs
as per `num_cpus::get().max(1)` (see [1], [2]). This is a reasonable default on
physical systems with unlimited resource access, but in containerized
environment Mononoke may be limited to a smaller number of CPUs than totally
available on a system. Let's add the ability to override the size of the thread
pool on the command line.

[1] https://github.com/tokio-rs/tokio/blob/tokio-udp-0.1.2/tokio-threadpool/src/builder.rs#L93
[2] tokio-rs/tokio#400

Reviewed By: farnz

Differential Revision: D19309494

fbshipit-source-id: 1fa4054b940bf225fac5f1a518f5cbb50d882fda
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

No branches or pull requests

2 participants