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

rt: fix default thread number logic #2457

Merged
merged 1 commit into from
Apr 28, 2020
Merged

rt: fix default thread number logic #2457

merged 1 commit into from
Apr 28, 2020

Conversation

carllerche
Copy link
Member

Previously, the function picking the default number of threads for the
threaded runtime did not factor in max_threads. Instead, it only used
the value returned by num_cpus. However, if num_cpus returns a value
greater than max_threads, then the function would panic.

This patch fixes the function by limiting the default number of threads
by max_threads.

Fixes #2452

Previously, the function picking the default number of threads for the
threaded runtime did not factor in `max_threads`. Instead, it only used
the value returned by `num_cpus`. However, if `num_cpus` returns a value
greater than `max_threads`, then the function would panic.

This patch fixes the function by limiting the default number of threads
by `max_threads`.

Fixes #2452
@carllerche carllerche added C-bug Category: This is a bug. A-tokio Area: The main tokio crate M-runtime Module: tokio/runtime labels Apr 28, 2020
@carllerche carllerche merged commit 1bf1928 into master Apr 28, 2020
@carllerche carllerche deleted the fix-2452 branch May 2, 2020 20:19
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0.2.17 regresssion: Core threads number cannot be above max limit
4 participants