git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Phillip Wood <phillip.wood123@gmail.com>,
	phillip.wood@dunelm.org.uk, James Liu <james@jamesliu.io>,
	Derrick Stolee <stolee@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v3 7/7] run-command: fix detaching when running auto maintenance
Date: Mon, 19 Aug 2024 11:04:42 +0200	[thread overview]
Message-ID: <ZsMKpNMDTysNcreR@tanuki> (raw)
In-Reply-To: <20240819084614.GA2955268@coredump.intra.peff.net>

On Mon, Aug 19, 2024 at 04:46:14AM -0400, Jeff King wrote:
> On Mon, Aug 19, 2024 at 08:17:22AM +0200, Patrick Steinhardt wrote:
> 
> > >   2. Having racy background maintenance doesn't seem great for test
> > >      robustness. At the very least, it might subject us to the "rm"
> > >      problems mentioned elsewhere, where we fail to clean up. Annotating
> > >      individual "git gc" or "git maintenance" calls with an extra
> > >      descriptor isn't too bad, but in this case it's all happening under
> > >      the hood via fetch. Is it a potential problem for every script,
> > >      then? If so, should we disable background detaching for all test
> > >      repos, and then let the few that want to test it turn it back on?
> > 
> > Might be a good idea to set `maintenance.autoDetach=false` globally,
> > yes. The only downside is of course that it wouldn't cause us to detect
> > failures like the above, where the concurrency itself causes failure.
> > 
> > Anyway, for now I'll:
> > 
> >   - Send a patch to fix the race in t7900.
> > 
> >   - Investigate the reftable concurrency issue.
> > 
> >   - _Not_ send a patch that sets `maintenance.autoDetach=false`.
> 
> That sounds like a good direction. I do suspect there are at least _two_
> races in t7900:
> 
>   1. the detached maintenance that we run explicitly, which causes the
>      "rm" cleanup to fail
> 
>   2. whatever earlier test is kicking off detached maintenance via "git
>      fetch", which is causing the reftable concurrency issue.
> 
> Fixing (1) should be easy (and it looks like you've already sent a
> series). Fixing the reftable code will stop us from segfaulting for (2),
> but I wonder if that detached maintenance might cause similar "rm" style
> problems elsewhere.

It certainly might. The only reason why I don't want to send that patch
now is that it feels a bit too reactionary. We haven't had issues in the
past with it to the best of my knowledge, even though it is an issue in
theory.

We can certainly revisit that though if we see that it indeed is a more
widespread issue.

> > The last one requires a bit more discussion first, and we have been
> > running with `gc.autoDetach=true` implicitly in the past. Thinking a bit
> > more about it, the reason why the above bug triggers now is that
> > git-gc(1) itself runs git-pack-refs(1), but does that _synchronously_
> > before detaching itself. Now we detach at a higher level in the
> > hierarchy, which means that the previously-synchronous part now runs
> > asynchronously, as well.
> 
> That makes sense. I guess we've perhaps been doing background gc for a
> long time, then, just not in the refs? In practice most repos in the
> test suite aren't big enough to trigger auto-gc anyway, so it may only
> affect a handful of scripts.

Yup. We should expect this to work just fine, because it can trigger
regardless of whether or not we run auto-compaction concurrently or not.
After all, the reftable backend even performs auto-compaction after
every write to the table, so any two concurrent writes may hit the bug
without even invoking git-maintenance(1) at all.

> Once the reftable issue is fixed, it's possible that the lingering
> detached processes don't cause a problem in practice (because they're
> not really writing much, and/or have finished by the time anybody else
> gets to cleanup), and we can just live with them. But I'm worried that
> sounds like wishful thinking. ;)

Could certainly be, yeah. I just want to focus on fixing the immediate
issues before we jump to conclusions too fast.

Patrick

  reply	other threads:[~2024-08-19  9:04 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13  7:17 [PATCH 0/7] builtin/maintenance: fix auto-detach with non-standard tasks Patrick Steinhardt
2024-08-13  7:17 ` [PATCH 1/7] config: fix constness of out parameter for `git_config_get_expiry()` Patrick Steinhardt
2024-08-13  7:17 ` [PATCH 2/7] builtin/gc: refactor to read config into structure Patrick Steinhardt
2024-08-15  5:24   ` James Liu
2024-08-15  8:18     ` Patrick Steinhardt
2024-08-15 13:46   ` Derrick Stolee
2024-08-13  7:17 ` [PATCH 3/7] builtin/gc: fix leaking config values Patrick Steinhardt
2024-08-15  5:22   ` James Liu
2024-08-15  8:18     ` Patrick Steinhardt
2024-08-15 13:50   ` Derrick Stolee
2024-08-13  7:17 ` [PATCH 4/7] builtin/gc: stop processing log file on signal Patrick Steinhardt
2024-08-15  6:01   ` James Liu
2024-08-13  7:17 ` [PATCH 5/7] builtin/gc: add a `--detach` flag Patrick Steinhardt
2024-08-13  7:17 ` [PATCH 6/7] builtin/maintenance: " Patrick Steinhardt
2024-08-13  7:18 ` [PATCH 7/7] builtin/maintenance: fix auto-detach with non-standard tasks Patrick Steinhardt
2024-08-13 11:29   ` Phillip Wood
2024-08-13 11:59     ` Patrick Steinhardt
2024-08-13 13:19       ` Phillip Wood
2024-08-14  4:15         ` Patrick Steinhardt
2024-08-14 15:13           ` Phillip Wood
2024-08-15  5:30             ` Patrick Steinhardt
2024-08-15  6:40   ` James Liu
2024-08-15  8:17     ` Patrick Steinhardt
2024-08-15 14:00   ` Derrick Stolee
2024-08-15  6:42 ` [PATCH 0/7] " James Liu
2024-08-15  9:12 ` [PATCH v2 " Patrick Steinhardt
2024-08-15  9:12   ` [PATCH v2 1/7] config: fix constness of out parameter for `git_config_get_expiry()` Patrick Steinhardt
2024-08-15  9:12   ` [PATCH v2 2/7] builtin/gc: refactor to read config into structure Patrick Steinhardt
2024-08-15  9:12   ` [PATCH v2 3/7] builtin/gc: fix leaking config values Patrick Steinhardt
2024-08-15  9:12   ` [PATCH v2 4/7] builtin/gc: stop processing log file on signal Patrick Steinhardt
2024-08-15  9:12   ` [PATCH v2 5/7] builtin/gc: add a `--detach` flag Patrick Steinhardt
2024-08-15 19:11     ` Junio C Hamano
2024-08-15 22:29       ` Junio C Hamano
2024-08-16  8:06         ` Patrick Steinhardt
2024-08-15  9:12   ` [PATCH v2 6/7] builtin/maintenance: " Patrick Steinhardt
2024-08-15  9:12   ` [PATCH v2 7/7] run-command: fix detaching when running auto maintenance Patrick Steinhardt
2024-08-15 16:13     ` Junio C Hamano
2024-08-16  8:06       ` Patrick Steinhardt
2024-08-15 14:04 ` [PATCH 0/7] builtin/maintenance: fix auto-detach with non-standard tasks Derrick Stolee
2024-08-15 15:37   ` Junio C Hamano
2024-08-16  8:06   ` Patrick Steinhardt
2024-08-16 10:44 ` [PATCH v3 " Patrick Steinhardt
2024-08-16 10:44   ` [PATCH v3 1/7] config: fix constness of out parameter for `git_config_get_expiry()` Patrick Steinhardt
2024-08-16 10:45   ` [PATCH v3 2/7] builtin/gc: refactor to read config into structure Patrick Steinhardt
2024-08-16 10:45   ` [PATCH v3 3/7] builtin/gc: fix leaking config values Patrick Steinhardt
2024-08-16 10:45   ` [PATCH v3 4/7] builtin/gc: stop processing log file on signal Patrick Steinhardt
2024-08-16 10:45   ` [PATCH v3 5/7] builtin/gc: add a `--detach` flag Patrick Steinhardt
2024-08-16 10:45   ` [PATCH v3 6/7] builtin/maintenance: " Patrick Steinhardt
2024-08-17  7:09     ` Jeff King
2024-08-17  7:14       ` Jeff King
2024-08-19  6:17       ` Patrick Steinhardt
2024-08-16 10:45   ` [PATCH v3 7/7] run-command: fix detaching when running auto maintenance Patrick Steinhardt
2024-08-17 12:14     ` Jeff King
2024-08-19  6:17       ` Patrick Steinhardt
2024-08-19  7:47         ` [PATCH 0/3] Fixups for git-maintenance(1) tests Patrick Steinhardt
2024-08-19  7:47           ` [PATCH 1/3] t7900: fix flaky test due to leaking background job Patrick Steinhardt
2024-08-19  8:49             ` Jeff King
2024-08-19  8:55               ` Patrick Steinhardt
2024-08-19  9:12                 ` Jeff King
2024-08-19  9:17                   ` Patrick Steinhardt
2024-08-19  7:48           ` [PATCH 2/3] t7900: exercise detaching via trace2 regions Patrick Steinhardt
2024-08-19  8:51             ` Jeff King
2024-08-19  8:56               ` Patrick Steinhardt
2024-08-21 18:38                 ` Junio C Hamano
2024-08-22  5:41                   ` Patrick Steinhardt
2024-08-22 17:22                     ` Junio C Hamano
2024-08-19  7:48           ` [PATCH 3/3] builtin/maintenance: fix loose objects task emitting pack hash Patrick Steinhardt
2024-08-19  8:55             ` Jeff King
2024-08-19  9:07               ` Patrick Steinhardt
2024-08-19  9:17                 ` Jeff King
2024-08-19  9:26                   ` Patrick Steinhardt
2024-08-19 10:26                     ` Jeff King
2024-08-20  7:39                       ` Patrick Steinhardt
2024-08-20 15:58                         ` Junio C Hamano
2024-08-19 17:05                   ` Junio C Hamano
2024-08-19  8:46         ` [PATCH v3 7/7] run-command: fix detaching when running auto maintenance Jeff King
2024-08-19  9:04           ` Patrick Steinhardt [this message]
2024-08-19 10:49       ` Patrick Steinhardt
2024-08-19 15:41         ` Patrick Steinhardt

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=ZsMKpNMDTysNcreR@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=james@jamesliu.io \
    --cc=peff@peff.net \
    --cc=phillip.wood123@gmail.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=stolee@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).