Repository navigation
fix(git): run gc in foreground to avoid race - #17818
Merged
Merged
Conversation
`-c gc.autoPackLimit=N` as a single argument doesn't really work for git.
Before rust-lang#16459 cargo ran `git gc` in foreground. The switch to `--auto` implicit run it in background which was not discussed there or in rust-lang#4656. I believe this was an oversight. rust-lang#17813 hits this because it hardlinks git's object store, and during gc there will be trasient lockfile. libgit2 and git cli also have this problem but just never hit it.
we already run `git gc --auto` unconditionally before fetch so avoid the redundant implicit one. We might want to revisit and let `git fetch` do that automatically and remove maybe_gc_repo, when git CLi becomes the sole git backend.
Collaborator
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
epage
approved these changes
Nov 26, 2026
epage
enabled auto-merge
November 26, 2026 22:48
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 26, 2026
Member
Author
|
windows-gnub stack overflowed again rust-lang/rust#166322 this should mitigate it requeuing |
rust-bors Bot
pushed a commit
to rust-lang/rust
that referenced
this pull request
Nov 28, 2026
Update cargo submodule 14 commits in ae8f06eb41b8c4a534d0f280f1b9d287f45ead73..39eba940bf913a566c4763c836cbe24b9f975200 2026-11-21 04:06:35 +0000 to 2026-11-27 22:28:03 +0000 - feat(config)!: Delegate `Definition` origin to `Origin` and precedence to `Scope` (rust-lang/cargo#17822) - Reduce the usage of `sleep_ms()` in testsuite (rust-lang/cargo#17819) - fix(clean): Don't double count hardlinks when actually cleaning (rust-lang/cargo#17805) - Reduce the usage of `sleep_ms()` in freshness tests (rust-lang/cargo#17816) - fix(git): run gc in foreground to avoid race (rust-lang/cargo#17818) - fix(script): Skip a UTF-8 BOM before parsing the frontmatter (rust-lang/cargo#17806) - Reduce the usage of `sleep_ms()` in testsuite (rust-lang/cargo#17815) - fix(compile): Differentiate levels of debug info (rust-lang/cargo#17798) - fix(profiles): line-tables-only on nightly only (rust-lang/cargo#17797) - fix(cli): Suggest `--profile debug` on all commands that default to `dev` (rust-lang/cargo#17796) - refactor: clarify home is cargo home (rust-lang/cargo#17790) - refactor(config)!: various polish (rust-lang/cargo#17787) - refactor(git): extract git backends to their own modules (rust-lang/cargo#17789) - docs: fix typos in documentation (rust-lang/cargo#17783) r? ghost
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR try to resolve?
git by default runs gc in a detached process in background,
which may race with other git fetch and checkout (#17813).
This
git fetch. It is redundant since we havemaybe_gc_reporun before fetchNotes to reviewers
For my rationale, see commit messages.
I am not sure if we want tests for them. It may need
GIT_TRACEor something to probe it.🤖 LLM involvement: Directed fix.