-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add workaround for sporadic kills when building on Macos #10196
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. Please see the contribution instructions for more information. |
Thanks for the PR! Can you say why this is specific to arm? I have been experiencing this on x86_64 myself. |
I thought it was linked to ARM and the fact that all applications requiring to being signed. Apparently it is only due to APFS. |
8c93678
to
d1f3039
Compare
This seems like a particularly heavy hammer for this issue since file copying can have a pretty significant performance impact on Cargo. It sounds like this is just intentionally slowing down Cargo to let other processes in the system settle which also would mean that this isn't actually solving the issue, it's just making it more rare. I don't know what a "proper" fix would look like since I'm not sure what we could synchronize on, but otherwise I think it would be useful to quantify what kind of a slowdown this will look like. |
@alexcrichton |
Oh nice! To confirm, have you benchmarked a bit before and after and seen no difference? |
On a Macbook Air M1, Monterey 12.1, cargo 1.58.0-nightly (40dc281 2021-12-06) I tested it with the already existing __CARGO_COPY_DONT_LINK_DO_NOT_USE_THIS env variable on cargo itself - difference not measurable. With hardlinks:
With CoW copies:
I regularly clone multiple GB files with |
d1f3039
to
66f6f3f
Compare
I forget precisely where and when we use hard links vs copies, but once we invoke rustc all bets are off because rustc is by far always going to be slower than Cargo. Could you try benchmarking builds where Cargo doesn't actually do anything? (where it basically just determines that the project is up-to-date). I think projects with a number of medium-sized binaries would be good to benchmark for that. |
I tried on rust-analyser project Clean build without and with removing target binary. The first one is a clean build to have everything built.
There is no apparent difference when cargo "does nothing" |
Awesome, thanks! Could you update the comment a bit with the performance implication where using the CoW-enabled syscall this should theoretically be just as fast as the hard linking version? |
66f6f3f
to
c9c67c0
Compare
Done |
@bors: r+ 👍 |
📌 Commit c9c67c0 has been approved by |
☀️ Test successful - checks-actions |
Update cargo 8 commits in a359ce16073401f28b84840da85b268aa3d37c88..fcef61230c3b6213b6b0d233a36ba4ebd1649ec3 2021-12-14 18:40:22 +0000 to 2021-12-17 02:30:38 +0000 - Minor docs change for `cargo test --help` (rust-lang/cargo#10210) - Make clippy happy (rust-lang/cargo#10205) - Enhance descriptions of issue templates (rust-lang/cargo#10202) - Add workaround for sporadic kills when building on Macos (rust-lang/cargo#10196) - Detect filesystem loop during walking the projects (rust-lang/cargo#10188) - Error about not having any crates with documentation (rust-lang/cargo#10204) - Don't document libs with doc=false (rust-lang/cargo#10201) - Bumps up tar to 0.4.36 (rust-lang/cargo#10198)
Update cargo 8 commits in a359ce16073401f28b84840da85b268aa3d37c88..fcef61230c3b6213b6b0d233a36ba4ebd1649ec3 2021-12-14 18:40:22 +0000 to 2021-12-17 02:30:38 +0000 - Minor docs change for `cargo test --help` (rust-lang/cargo#10210) - Make clippy happy (rust-lang/cargo#10205) - Enhance descriptions of issue templates (rust-lang/cargo#10202) - Add workaround for sporadic kills when building on Macos (rust-lang/cargo#10196) - Detect filesystem loop during walking the projects (rust-lang/cargo#10188) - Error about not having any crates with documentation (rust-lang/cargo#10204) - Don't document libs with doc=false (rust-lang/cargo#10201) - Bumps up tar to 0.4.36 (rust-lang/cargo#10198)
This is the workaround for the issue #10060