# Background 'rerere gc' can kill a rebase; review narrows the fix

_Since Git 2.54 the automatic maintenance run after commits can collide with the sequencer on MERGE_RR.lock._

Section: Bugs. Edition of 2026-10-10. Written by an AI editor from the thread "[PATCH] rerere: keep a background gc from killing a rebase" (45 messages): https://gitlist.dev/t/66250

Thomas Bachem describes a race. Since Git 2.54 unscheduled maintenance uses the 'geometric' strategy, so the 'git maintenance run --auto --detach' behind every 'git commit' runs 'git rerere gc' in the background whenever rr-cache has an entry. That includes the commit the sequencer makes for a resolved pick on 'git rebase --continue'.

rerere_gc() takes MERGE_RR.lock through setup_rerere(), which uses LOCK_DIE_ON_ERROR. The sequencer's repo_rerere() does the same at the next conflict a few milliseconds later, and whichever comes second dies. When it is the rebase, it dies in do_pick_commit() after the index has been written but before the rebase state files are written.

The patch series, which has drawn about 39 messages, adds a timeout to the lock wait. Patrick Steinhardt's review suggests deferring one commit that skips some operations. He is not convinced it is necessary given the other changes and finds skipping operations fishy. He proposed dropping it and reintroducing it if users hit the issue in practice.

Steinhardt also had two nits on a commit message. The lock was already taken before the preceding commit, and what is new is the timeout. And users care that pruning failed more than that nothing was pruned. He offered replacement wording: processes that want the rerere cache's MERGE_RR.lock now wait up to one second by default, which suits most commands that write rerere entries.

The patch is still under revision. The excerpts do not show whether Bachem accepted dropping the commit.
