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

Replace dep jobserver with jobslot #1317

Closed
wants to merge 1 commit into from

Conversation

NobodyXu
Copy link
Contributor

@NobodyXu NobodyXu commented Sep 12, 2022

Signed-off-by: Jiahao XU Jiahao_XU@outlook.com

This PR replaces dep jobserver with a fork jobslot.

Advantages over jobserver?

  • jobslot contains bug fix for Client::configure is unsafe
  • jobslot removed use of signal handling in the helper thread on unix
  • jobslot uses winapi on windows instead of manually declaring bindings (some of the bindings seem to be wrong)
  • jobslot uses getrandom on windows instead of making homebrew one using raw windows api

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@sylvestre
Copy link
Collaborator

I am quite reluctant to move to a fork. Especially when the original maintainer is the amazing @alexcrichton

You also don't share enough information about the performance improvement.

@sylvestre
Copy link
Collaborator

If rust-lang/cargo#11066 is merged, maybe we will consider merging this PR but we probably won't until this.

@NobodyXu
Copy link
Contributor Author

You also don't share enough information about the performance improvement.

On unix, jobserver::Client::configure uses std::os::unix::process::CommandExt::pre_exec to register a callback which removes CLOEXEC flags set on the jobserver fds (essentially just pipes).

Since the callback can do whatever it wants, Command::spawn cannot use vfork + exec, thus it will take longer to spawn the new process and also might cause memory overcommit.

Both sccache and sccache-dist are quite large (roughly 20MB), so it is affected by this.
It also depends on the memory taken up by them at runtime, so the more virtual memory it takes, the slower fork + exec.

Though I did not run any benchmarks so I can't say for sure how much of a speedup it would be.

@sylvestre
Copy link
Collaborator

Without data, I am even less convinced to merge it than I was before :)

@NobodyXu
Copy link
Contributor Author

NobodyXu commented Sep 12, 2022

Without data, I am even less convinced to merge it than I was before :)

Well, the main motivation for me to fork it is to fix the bug plus refactoring, the better performance is just a side-effect.
But anyway, the fork at least should not cause any regression in the performance of sccache.

Other improvements in jobslot includes:

  • Remove use of signal handling in the helper thread on unix to make it more robust
  • Use winapi on windows instead of manually declaring bindings (some of the bindings seem to be wrong)
  • Use getrandom on windows instead of making homebrew one using raw windows api

@sylvestre
Copy link
Collaborator

Sure, I understand that you think it is the right approach but I am not going to switch sccache to a 2 days-old new crate when I have no idea how long it is going to be maintained (while Alex has been maintaining jobserver for 5 years).

@NobodyXu
Copy link
Contributor Author

Sure, I understand that you think it is the right approach but I am not going to switch sccache to a 2 days-old new crate when I have no idea how long it is going to be maintained (while Alex has been maintaining jobserver for 5 years).

Yes I fully understand your decision to not switch right now.

Though jobslot has slightly less bus factor (not offensive to anyone) as it is put in an organization cargo-bins and another person in the org also has access to crates.io

Honestly I am astonished how many well-known crates in rust do not receive enough maintainance.
zip, tar, jobserver, etc.
Perhaps it is a good time to put them in rust-lang...

@sylvestre
Copy link
Collaborator

Honestly I am astonished how many well-known crates in rust do not receive enough maintainance.

This is the case of opensource as a whole...

@NobodyXu
Copy link
Contributor Author

This is the case of opensource as a whole...

sad but indeed true.

@sylvestre
Copy link
Collaborator

closing for now

@sylvestre sylvestre closed this Oct 6, 2022
@NobodyXu NobodyXu deleted the use-jobslot branch October 6, 2022 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants