-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
bootstrap: respect POSIX jobserver #152057
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
Merged
rust-bors
merged 1 commit into
rust-lang:main
from
haampie:hs/fix/bootstrap-respect-jobserver-protocol
Feb 20, 2026
+20
−4
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was intentional because of #56090 (comment). I don't know if that issue has been fixed since or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jobserver-rs has much better diagnostics now, even if it's not fixed now it will be more clear what's going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll have a look. Possibly I could split the PR in two; the
bootstrap - cmake - ninja-build - ...process tree doesn't havecargoin it.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quickly looked at it. Few observations:
The "bad file descriptor" issue applies only to old style jobservers that work with pipes. The issue happens when a parent process either closes the file descriptors explicitly or makes them non-inheritable, yet continues to advertise them in the
MAKEFLAGSenvironment variable to child processes.As far as I can see,
sccachecloses file descriptors explicitly, but for a valid reason: they start a daemon the first time you runsccachewith has a lifetime (heh) longer than the jobserver. Afterwards, they start their own jobserver, and I suppose they set their own MAKEFLAGS too then.Another source of this issue is possibly the Python scripts in this repo. Python defaults to making file descriptors non-inheritable (PEP 445). So, to support an old style jobserver,
subprocess.Popen(..., close_fds=False)should be used inbootstrap.pyin this repo.However, given that (a)
ninjaonly supports the new style jobserver, and (b) thesccachelogic about closing fds doesn't run with the new style jobserver, I don't think it's worth trying to support the old jobserver protocol.So, my proposal is, if
MAKEFLAGScontains the string--jobserver-auth=fifo:(new style jobserver):MAKEFLAGSverbatim to child processes-j Ntocmaketo ensurecmakeandninjarespect the jobserverThat would be the minimal change, and there shouldn't be any
bad file descriptorerrors.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pushed a change, I don't think there should be any concerns related to "bad file descriptor" issues now.