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

[beta] Revert #10427: switch from num_cpus #10737

Merged
merged 1 commit into from Jun 8, 2022

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Jun 8, 2022

This temporarily reverts #10427 (Use available_parallelism instead of num_cpus) per the discussion at rust-lang/rust#97549. available_parallelism does not handle cgroups v1 on Linux unlike num_cpus. I am concerned that this potentially affects a significant percentage of users. For example, Docker just added cgroups v2 support last year. Various Linux distributions have only recently switched to it as the default. The following is what I can find on the web:

  • Fedora (since 31)
  • Arch Linux (since April 2021)
  • openSUSE Tumbleweed (since c. 2021)
  • Debian GNU/Linux (since 11)
  • Ubuntu (since 21.10)
  • RHEL and RHEL-like distributions (since 9)

This also appears to affect CircleCI.

The consequence is that Cargo ends up using too much parallelism and can run out of memory.

I'm not sure what to do about 1.63. If std adds support for cgroups v1, then I don't think there is anything to do there. Otherwise I think we should revert similarly if that doesn't happen.

This reverts commit 6d11f9e, reversing
changes made to c5cdd25.
@rust-highfive
Copy link

@ehuss: no appropriate reviewer found, use r? to override

@rust-highfive
Copy link

⚠️ Warning ⚠️

  • Pull requests are usually filed against the master branch for this repo, but this one is against rust-1.62.0. Please double check that you specified the right target!

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 8, 2022
@Mark-Simulacrum
Copy link
Member

From a release perspective, I'd encourage us to revert on nightly/master too now, rather than hoping to remember to reapply this in case it's not changed in std itself. (Particularly given that we don't (?) have tests in Cargo for this?)

@weihanglo
Copy link
Member

Thanks for the thorough investigation on different platforms.

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 8, 2022

📌 Commit 0cfdbc0 has been approved by weihanglo

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 8, 2022
@bors
Copy link
Collaborator

bors commented Jun 8, 2022

⌛ Testing commit 0cfdbc0 with merge a748cf5...

@weihanglo
Copy link
Member

From a release perspective, I'd encourage us to revert on nightly/master too now, rather than hoping to remember to reapply this in case it's not changed in std itself. (Particularly given that we don't (?) have tests in Cargo for this?)

Just opened #10739

@bors
Copy link
Collaborator

bors commented Jun 8, 2022

☀️ Test successful - checks-actions
Approved by: weihanglo
Pushing a748cf5 to rust-1.62.0...

@bors bors merged commit a748cf5 into rust-lang:rust-1.62.0 Jun 8, 2022
bors added a commit that referenced this pull request Jun 9, 2022
Revert #10427: switch from num_cpus

Same as #10737 but on nightly
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 9, 2022
Revert "remove num_cpus dependency" in rustc and update cargo

Fixes rust-lang#97549. This PR reverts rust-lang#94524 and does a Cargo update to pull in rust-lang/cargo#10737.

Rust 1.61.0 has a regression in which it misidentifies the number of available CPUs in some environments, leading to enormously increased memory usage and failing builds. In between Rust 1.60 and 1.61 both rustc and cargo replaced some uses of `num_cpus` with `available_parallelism`, which eliminated support for cgroupv1, still apparently in common use. This PR switches both rustc and cargo back to using `num_cpus` in order to support environments where the available parallelism is controlled by cgroupv1. Both can use `available_parallism` again once it handles cgroupv1 (if ever).

I have confirmed that the rustc part of this PR fixes the memory usage regression in my non-Cargo environment, and others have confirmed in rust-lang#97549 that the Cargo regression was at fault for the memory usage regression in their environments.
ehuss pushed a commit to ehuss/rust that referenced this pull request Jun 24, 2022
Revert "remove num_cpus dependency" in rustc and update cargo

Fixes rust-lang#97549. This PR reverts rust-lang#94524 and does a Cargo update to pull in rust-lang/cargo#10737.

Rust 1.61.0 has a regression in which it misidentifies the number of available CPUs in some environments, leading to enormously increased memory usage and failing builds. In between Rust 1.60 and 1.61 both rustc and cargo replaced some uses of `num_cpus` with `available_parallelism`, which eliminated support for cgroupv1, still apparently in common use. This PR switches both rustc and cargo back to using `num_cpus` in order to support environments where the available parallelism is controlled by cgroupv1. Both can use `available_parallism` again once it handles cgroupv1 (if ever).

I have confirmed that the rustc part of this PR fixes the memory usage regression in my non-Cargo environment, and others have confirmed in rust-lang#97549 that the Cargo regression was at fault for the memory usage regression in their environments.
@ehuss ehuss added this to the 1.62.0 milestone Jul 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants