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

use named pipe when creating new jobserver #13483

Closed
NobodyXu opened this issue Feb 23, 2024 · 7 comments
Closed

use named pipe when creating new jobserver #13483

NobodyXu opened this issue Feb 23, 2024 · 7 comments
Labels
A-jobserver Area: jobserver, concurrency, parallelism C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

Comments

@NobodyXu
Copy link

NobodyXu commented Feb 23, 2024

Thanks, my proposed solution is to change rust-lang/jobserver to use a named pipe instead of an annoymous one.

The named pipe is passed down by its path in filesystem and opening it using O_NONBLOCK doesn't affect others.

We can also retain backwards compatibility by keeping the jobserver fds inheritable and keeping them in the environment variable.

E.g. MAKEFLAGS='--jobserver-auth=fifo:/path/to/fifo --jobserver-fds=3,5'

Originally posted by @NobodyXu in #13476 (comment)

@NobodyXu
Copy link
Author

cc @weihanglo since you also interacted with the issue in cargo.

@weihanglo
Copy link
Member

Thanks for the report.

This is somehow blocked on rust-lang/jobserver-rs#47 or something need to be done there I feel like. How can Cargo help the situation, or is this just a tracking issue of that?

@weihanglo weihanglo added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` A-jobserver Area: jobserver, concurrency, parallelism S-triage Status: This issue is waiting on initial triage. labels Feb 23, 2024
@NobodyXu
Copy link
Author

This is somehow blocked on rust-lang/jobserver-rs#47 or something need to be done there I feel like.

Hmmm is that for previous cargo release which uses an old jobserver version?

I thought that latest version of jobserver can handle it just well?

How can Cargo help the situation, or is this just a tracking issue of that?

I will open a PR in next few days, and hopefully we can cut a new patch release of cargo to use the latest jobserver release.

@weihanglo
Copy link
Member

I thought that latest version of jobserver can handle it just well?

🤔… Unless I missed something important, there seems no way for Cargo to create a fifo jobserver via jobserver crate.

@NobodyXu
Copy link
Author

Unless I missed something important, there seems no way for Cargo to create a fifo jobserver via jobserver crate.

That's what I'm proposing: change jobserver::Client::new to create a fifo instead of pipe by default and retain backwards compatibility by making it inheritable with env MAKEFLAGS='--jobserver-auth=fifo:/path/to/fifo --jobserver-fds=3,5'.

AFAIK --jobserver-auth is introduced when fifo is first supported in make.

@weihanglo weihanglo added S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix and removed S-triage Status: This issue is waiting on initial triage. labels Feb 23, 2024
@NobodyXu
Copy link
Author

I was meant to create this on rust-lang/iobserver 😂

@NobodyXu
Copy link
Author

Unfortunately, --jobserver-auth is introduced in 4.2, but fifo jobserver and --jobserver-style is introduced in make 4.4

This means that if we use fifo we would break backwards compatibility, so closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-jobserver Area: jobserver, concurrency, parallelism C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix
Projects
None yet
Development

No branches or pull requests

2 participants