Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Thomas Bachem via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Phillip Wood <phillip.wood@dunelm.org.uk>,
	Junio C Hamano <gitster@pobox.com>,
	Thomas Bachem <mail@thomasbachem.com>
Subject: Re: [PATCH v3] rerere: keep a background gc from killing a rebase
Date: Mon, 7 Sep 2026 09:41:03 +0200	[thread overview]
Message-ID: <ap5qj9wckDeKlI7i@pks.im> (raw)
In-Reply-To: <pull.2214.v3.git.1788537081930.gitgitgadget@gmail.com>

On Fri, Sep 04, 2026 at 03:51:21PM +0000, Thomas Bachem via GitGitGadget wrote:
> From: Thomas Bachem <mail@thomasbachem.com>
> 
> A "git rerere gc" holds MERGE_RR.lock for as long as pruning rr-cache
> takes, and since 2.54 the auto maintenance after every commit runs
> one whenever rr-cache has an entry. The commit a rebase spawns for a
> resolved pick starts it too, and the sequencer's repo_rerere() at the
> next conflict wants the lock a few milliseconds later. Both take it
> with LOCK_DIE_ON_ERROR, so whichever comes second dies. When it is
> the rebase, the index is written but the state for "git rebase
> --continue" is not, and every later continue refuses with "you have
> staged changes".

Haven't we said that this race is not exclusive to `git rerere gc` with
a concurrent writer though? It also happens between two normal writers.
So it's good to have the context that we discovered this race because of
the changed heuristics in maintenance, but we should clarify that it's a
longer-standing conceptual issue.

> diff --git a/Documentation/config/rerere.adoc b/Documentation/config/rerere.adoc
> index 3a78b5ebb1..14ef193545 100644
> --- a/Documentation/config/rerere.adoc
> +++ b/Documentation/config/rerere.adoc
> @@ -10,3 +10,13 @@ rerere.enabled::
>  	enabled if there is an `rr-cache` directory under the
>  	`$GIT_DIR`, e.g. if "rerere" was previously used in the
>  	repository.
> +
> +rerere.lockTimeout::
> +	The length of time, in milliseconds, to retry when trying to
> +	take the rerere lock while another process holds it, typically
> +	a background `git rerere gc`.  When the time is up, the command
> +	warns and goes on without rerere.  Value 0 means not to retry
> +	at all; -1 means to try indefinitely.  Default is 1000 (i.e.,
> +	retry for 1 second).  `git rerere gc` does not retry at all.
> +	`git rerere`, `git rerere forget` and `git rerere clear` retry
> +	the same way, but fail when the time is up instead of going on.

I'm not a 100% sold that it's sensible to just skip writing the rerere
entry. But maybe it's more sensible to regress gracefully compared to
just aborting the whole command?

In any case, I feel like this change warrants its own preparatory commit
so that we can discuss separately why it's a good idea to ignore those
failures.

Patrick

      parent reply	other threads:[~2026-09-07  7:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  8:31 [PATCH] rerere: keep a background gc from killing a rebase Thomas Bachem via GitGitGadget
2026-09-02 13:27 ` Phillip Wood
2026-09-02 15:07   ` Thomas Bachem
2026-09-03 13:50     ` Phillip Wood
2026-09-03  7:40 ` Patrick Steinhardt
2026-09-03  8:11   ` Thomas Bachem
2026-09-03  8:32     ` Patrick Steinhardt
2026-09-03 12:12       ` Thomas Bachem
2026-09-03 13:50       ` Phillip Wood
2026-09-04  7:44 ` [PATCH v2] " Thomas Bachem via GitGitGadget
2026-09-04 15:21   ` Phillip Wood
2026-09-04 15:55     ` Thomas Bachem
2026-09-07 10:07       ` Phillip Wood
2026-09-04 17:06     ` Junio C Hamano
2026-09-04 18:17       ` Thomas Bachem
2026-09-04 15:51 ` [PATCH v3] " Thomas Bachem via GitGitGadget
2026-09-04 19:08   ` Junio C Hamano
2026-09-05  5:41     ` Thomas Bachem
2026-09-05 16:10       ` Junio C Hamano
2026-09-06 10:29         ` Thomas Bachem
2026-09-07  7:41   ` Patrick Steinhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ap5qj9wckDeKlI7i@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=mail@thomasbachem.com \
    --cc=phillip.wood@dunelm.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox