Repository navigation
fix: keep git's automatic maintenance in the foreground - #4
Merged
Merged
Conversation
fernandorocagonzalez
added a commit
that referenced
this pull request
Nov 17, 2026
The test check fails on main right now, not just on PRs. A manual run on main today gives 99.76% lines, with one line missed. The runner moved to rust 1.100, which counts the implicit else of the `if let` in `commits()` as a line of its own, and no test ever produced a git log line without four fields. The nightly only runs audit and deny, which is why nobody saw it. This moves the parsing into `parse_log` and adds a unit test that feeds it a malformed line, so the skip is actually checked instead of just counted. Behaviour doesn't change. How I checked it: in a container with rust 1.100.0, cargo-llvm-cov 0.9.1 (same as CI) and a recent git, main reports the single miss at src/cli.rs:273 and this branch reports 100% lines. This unblocks #4.
After a fetch git starts gc --auto (maintenance run --auto on 2.47+) and detaches it. The detached child is reparented to PID 1, and in a container without an init that is the service itself, which never reaps it, so every pull left a [git] <defunct> zombie behind. run_git now passes -c gc.autoDetach=false -c maintenance.autoDetach=false, so the maintenance runs inside the git we wait on and is bounded by the same timeout.
fernandorocagonzalez
force-pushed
the
fix/foreground-maintenance
branch
from
November 17, 2026 15:31
daa5e49 to
a3fcbd1
Compare
Merged
fernandorocagonzalez
pushed a commit
that referenced
this pull request
Nov 17, 2026
🤖 I have created a release *beep* *boop* --- ## [0.2.1](v0.2.0...v0.2.1) (2026-11-17) ### Fixed * keep git's automatic maintenance in the foreground ([#4](#4)) ([f3f7468](f3f7468)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
fernandorocagonzalez
added a commit
to OpusProjects/unified-api
that referenced
this pull request
Nov 17, 2026
Moves git-rs to v0.2.1 (OpusProjects/git#4). After a fetch, git used to detach its automatic maintenance, which then got orphaned on PID 1 and stayed behind as a `[git] <defunct>`, one per pull. Now it runs in the foreground, inside the git we already wait on, so it is bounded by the project's timeout. This goes together with #291 (tini as PID 1). Either one fixes the git zombies on its own. tini also covers anything a connector script leaves behind, and this covers whoever runs the binary without an init, like a plain `docker run` or a systemd unit with a custom setup. Only the git-rs entry changes in Cargo.lock. I edited it by hand because `cargo update -p git-rs` also re-resolved unrelated crates (windows-sys, base64). Build with --locked, clippy and the full test suite all pass locally.
fernandorocagonzalez
added a commit
to OpusProjects/unified-gitops
that referenced
this pull request
Nov 17, 2026
Moves git-rs to v0.2.1 (OpusProjects/git#4). After a fetch, git used to detach its automatic maintenance, which then got orphaned on PID 1 and stayed behind as a `[git] <defunct>`, one per pull. Now it runs in the foreground, inside the git we already wait on. Same fix unified-api got in OpusProjects/unified-api#293. Only the git-rs entry changes in Cargo.lock, and it builds with --locked. Tests pass locally. It needs #54 merged first so deny goes green.
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.
After a fetch, git launches its automatic maintenance (gc --auto, or maintenance run --auto on 2.47 and later) and detaches it. The detached child gets reparented to PID 1. In a container with no init, PID 1 is the service itself, and it never waits on children it didn't spawn, so every pull left a
[git] <defunct>behind. On the central instance that was around 111 zombies after a few days.run_git now passes
-c gc.autoDetach=false -c maintenance.autoDetach=false, so the maintenance runs inside the git we already wait on and falls under the same timeout. Both keys are needed because git before 2.47 only reads gc.autoDetach, and an older git simply ignores the key it doesn't know. They go on the command line instead of GIT_CONFIG_* because auth_env already uses that numbered list for the auth header.How I checked it: a small binary calling CliGit::ensure, run as PID 1 in debian:trixie-slim (git 2.47.3) with gc.auto=1 on the checkout. With v0.2.0 the zombie count goes up by one on every pull (2 to 7 over six pulls). With this branch it stays flat. unified-api's whole test suite also passes against this branch through a local [patch].
The image side (tini as PID 1) goes in a separate unified-api PR.