Skip to content

Pin cache entries still in use #13137

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

Open
epage opened this issue Dec 8, 2023 · 1 comment
Open

Pin cache entries still in use #13137

epage opened this issue Dec 8, 2023 · 1 comment
Labels
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 Z-gc Nightly: garbage collection

Comments

@epage
Copy link
Contributor

epage commented Dec 8, 2023

Problem

Regardless of what automatic cleanup schedules we or the user chooses, we can end up removing files people need and they might not find out until they run in offline mode.

Proposed Solution

With #13136, we should know where all lockfiles are. We at least could pin all locally non-recreatable cache entries (e.g. index entries, .crate files) so that they don't get cleaned up, regardless of their age. Whether we should also pin recreatable cache entries is less clear though . It could help when a projects blow past low limits (see #12634 (comment)).

The main risk is the performance hit of reading all lockfiles and matching those to cache entries.

Notes

Blocked on #13136

@epage epage added C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` S-needs-team-input Status: Needs input from team on whether/how to proceed. Z-gc Nightly: garbage collection labels Dec 8, 2023
@ehuss
Copy link
Contributor

ehuss commented Apr 29, 2025

The team talked about this today and generally in agreement that it would be nice if we can do this. The main issues are:

  • Blocked on tracking the locations of all Cargo.lock files (or whatever similar tracking mechanism) in Garbage collect whole target/ #13136
  • Overall concerns about complexity and performance. Would need some investigation and experimentation.
    • Parsing all Cargo.lock files could be quite slow. This could be addressed with things like hashing the Cargo.lock file and recording the hash entries in the database, or some other database tracking mechanism.
    • Cargo.lock files could also be on removable drives, or network drives. Could cause hangs or other problems trying to open all of them.
    • Is this a use case that is important enough to justify the added complexity to cargo? Tough to determine since we are biased by having fast and readily available internet.

@ehuss ehuss removed the S-needs-team-input Status: Needs input from team on whether/how to proceed. label Apr 29, 2025
@epage epage added the S-blocked-external Status: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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 Z-gc Nightly: garbage collection
Projects
None yet
Development

No branches or pull requests

2 participants