Skip to content

Add a jobserver proxy to ensure at least one token is always held #140145

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Apr 22, 2025

This adds a jobserver proxy to ensure at least one token is always held by rustc. Currently with -Z threads rustc can temporarily give up all its tokens, causing cargo to spawn additional rustc instances beyond the job limit.

The current behavior causes an issue with cargo fix which has a global lock preventing concurrent rustc instances, but it also holds a jobserver token, causing a deadlock when rustc gives up its token. That is fixed by this PR.

Fixes #133873 and #140093.

@rustbot
Copy link
Collaborator

rustbot commented Apr 22, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 22, 2025
@jieyouxu
Copy link
Member

r? @SparrowLii

@rustbot rustbot assigned SparrowLii and unassigned jieyouxu Apr 22, 2025
@SparrowLii
Copy link
Member

cc @matthiaskrgr

@SparrowLii
Copy link
Member

Thanks!
@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 22, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 22, 2025
Add a jobserver proxy to ensure at least one token is always held

This adds a jobserver proxy to ensure at least one token is always held by `rustc`. Currently with `-Z threads` `rustc` can temporarily give up all its tokens, causing `cargo` to spawn additional `rustc` instances beyond the job limit.

The current behavior causes an issue with `cargo fix` which has a global lock preventing concurrent `rustc` instances, but it also holds a jobserver token, causing a deadlock when `rustc` gives up its token. That is fixed by this PR.

Fixes rust-lang#133873 and rust-lang#140093.
@bors
Copy link
Collaborator

bors commented Apr 22, 2025

⌛ Trying commit 141055f with merge c4cd906f6dc68c4343777d06a86285dbccb53e58...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-perf Status: Waiting on a perf run to be completed. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

-Zthreads causes rustfix/jobserver to deadlock
6 participants