-
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
Cargo should release Make jobserver token when it's waiting for file lock #6747
Comments
Hopefully useful for rust-lang/cargo#6747
Hopefully useful for rust-lang/cargo#6747
It seems to work, at least with the small testcase from this report and a few other small testcases I derived from it. |
@glandium pinged me on the original bug, so I tried to test that PR on the exactly same environment (a GCP n1-highcpu-8 instance). In conclusion, that patch helps CPU utilization a lot, although it doesn't seem to help on total build time of Firefox at all (which is a separate issue related to Firefox's build system I guess). This is the CPU usage graph building Firefox on this instance with an unpatched Cargo: This is the CPU usage graph with an patched Cargo: As can be seen that with the patched Cargo, CPU utilization is keep being 100% for most of the time, while previously much less. |
Release a jobserver token while locking a file This is a possible solution to #6747, but we'll ideally get some testing in before landing!
#6748 seems to have made it to 0.37.0, which would correspond to rust 1.36.0, right? Unfortunately, it seems there might still be some related issue. https://taskcluster-artifacts.net/HqtjBjwlSFG7K6E-DQYasQ/0/public/build/build_resources.html |
So this should be reopened, right? |
That said, it's only been reverted this week, so 1.36.0 should have it? |
Sure, can reopen. I don't know how this is actionable though with a solution. |
Consider the following Makefile:
And the directory containing the Makefile contains the following
Cargo.toml
:first
andsecond
are just created withcargo new
, with an additionalbuild.rs
each that contains the following:Now, run the build with
make -j2
.The timeline of what happens looks like the following:
echo start third
thensleep 2
echo end third
.Obviously, this is all synthetic, and cargo releasing the make jobserver token as proposed in the summary would not change the outcome in this example, being that the build would still take 4 seconds. But what it would allow is for make to start running the third target earlier, and that could make a hell of a difference.
The real world manifestation is https://bugzilla.mozilla.org/show_bug.cgi?id=1533988 which is caused by the Firefox build system invoking three cargo commands in the same workspace, two of which are "Blocking waiting for file lock on build directory", and the one that does work is actually likely to not be using all the cores available because of how a lot of the dependency chain of the crates built is linear. So the two cargos doing nothing are preventing more C++ compiler processes working while the first cargo works.
Cc: @alexcrichton
The text was updated successfully, but these errors were encountered: