-
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
Hold the mutate exclusive lock when vendoring #12509
Conversation
I assume this is related to #12254? |
Thanks and sorry I didn't speak it more clearly. I would expect to see acquiring a lock there first. If somebody can working on digging into the issue deeper, we can perhaps remove this piece of code when we feel safe. Thinking a bit more on the integrity of |
Just FYI, I don't think the existing locking would help here, since the problem is with the build process which does not hold a lock. I am currently reworking locking for the garbage collection support, which adds read locks to the build process. It might be usable for this situation. I'm also curious, the other alternative from the original issue was to read from the |
Do you mean we need to unpack it again from |
Yea, to have |
I think it can be done. The tricky part is that we have to calculate the checksum for each file we want to copy. So we may need another But there is an easy way to do it, we can unpack it to a temp folder first and then execute the original logic. But I think this has a big impact on performance. |
@ehuss Do you think this is a reasonable way to move forward? I am happy to give it a try. |
I'm looking over the vendor code, and I think it looks like it would be quite challenging to directly extract from the #12706 is introducing the cache locking support. That might be a much easier option, since it would be a roughly one line change to acquire an exclusive lock. It's still unpleasant, since this Unfortunately I don't think I have the time to dig into exactly how to architect a design that would support extracting |
r? weihanglo Would find a time looking into it and discuss with hi-rustin :) |
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
8618a82
to
2e77dc1
Compare
Could not assign reviewer from: |
I've added the exclusive lock now. But it is still very difficult to remove @weihanglo @ehuss Should we move forward with this PR? Or do you have any other thoughts? |
I'm fine with moving forward with this. I agree that it seems like removing |
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 works as expected. Thank you.
Still not pleasant, as now cargo hold the mutate exclusive lock for the entire duration of cargo vendor
.
I wonder if there is a way to “downgrade” from MutateExclusive
to DownloadExclusive
/Shared
so that cargo doesn't need to hold the lock that long.
@bors r+ |
☀️ Test successful - checks-actions |
Update cargo 10 commits in 1a2666ddd14cf0a255d4ddb61c63531c259a7b39..363a2d11320faf531f6aacd1ea067c6bc08343b9 2023-12-17 17:53:53 +0000 to 2023-12-22 03:12:42 +0000 - refactor: centralize git checkouts and db paths (rust-lang/cargo#13187) - Bump to 0.78.0; update changelog (rust-lang/cargo#13192) - refactor: custom error types for `cargo-util-schemas` (rust-lang/cargo#13186) - chore(deps): update rust crate handlebars to `v4.5.0` (rust-lang/cargo#13168) - Hold the mutate exclusive lock when vendoring (rust-lang/cargo#12509) - refactor: clean up package metadata (rust-lang/cargo#13184) - ci: check SemVer for cargo-util-schemas on CI (rust-lang/cargo#13185) - refactor(schemas): Pull out as `cargo-util-schemas` (rust-lang/cargo#13178) - chore(rustfix): rename Readme.md to README.md (rust-lang/cargo#13181) - chore(rustfix): remove useless clippy rules and fix a typo (rust-lang/cargo#13182) r? ghost
What does this PR try to resolve?
close #12254
Held the mutate exclusive lock when vendoring. This would block all other processes which want to read or change the unpacked files.
See: #12509 (comment)
r? @weihanglo