Git development
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Cc: Git mailing list <git@vger.kernel.org>,
	Harald Nordgren <haraldnordgren@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v4 1/2] test-lib: run EXPENSIVE tests one at a time
Date: Tue, 1 Dec 2026 14:19:49 +0100	[thread overview]
Message-ID: <aw7JdcNAxOAIQpjH@pks.im> (raw)
In-Reply-To: <3fba9f96-47e3-47c0-b540-92af0190fdc3@gmail.com>

On Tue, Dec 01, 2026 at 06:20:52PM +0530, Kaartic Sivaraam wrote:
> On 12/1/26 16:37, Patrick Steinhardt wrote:
> > On Tue, Dec 01, 2026 at 02:17:48PM +0530, Kaartic Sivaraam wrote:
> > > On 12/1/26 12:52, Patrick Steinhardt wrote:
> > > > I feel like re-checking the lock owner is kind of pointless here. The
> > > > check doesn't fix the race, but it suggests it to the reader. And that
> > > > is overall fine, because the intent now is to fail in a way that we
> > > > prefer to run the test instead of blocking forever.
> > > > 
> > > > But it raises the question why we even bother to check again. To me it
> > > > only causes puzzlement.
> > > > 
> > > 
> > > The re-check is present in order to prevent a specific race scenario pointed
> > > out by Junio:
> > > 
> > > >   * T1 holds $expensive_lock_, finishes its last EXPENSIVE test,
> > > >     calls release_expensive_lock_ (rm -rf "$expensive_lock_"), and
> > > >     exits.
> > > > 
> > > >   * Waiter T2 read owner=$(cat "$expensive_lock_/pid" 2>/dev/null)
> > > >     (obtaining T1's PID) just before T1 removed the directory.
> > > > 
> > > >   * Waiter T3 runs mkdir "$expensive_lock_", succeeds, writes T3's
> > > >     PID to pid, and begins its EXPENSIVE test.
> > > > 
> > > >   * T2 now checks test -n "$owner" && ! kill -0 "$owner" 2>/dev/null
> > > >     against T1's exited PID, finds that T1 is gone, runs rm -rf
> > > >     "$expensive_lock_", which deletes T3's active lock.  It loops,
> > > >     succeeds on mkdir "$expensive_lock_", and runs its EXPENSIVE test
> > > >     concurrently with T3.
> > > 
> > > 
> > > It talks about the variant that created directories but it applies for the
> > > current linking variant also.
> > > 
> > > If we could improve the comment above the relevant code in someway, do let
> > > me know. It tries to convey it but I unfortunately couldn't get what detail
> > > it is missing.
> > 
> > But the race isn't fully fixed, is it? You have simply narrowed the race
> > window, but the race itself still exists between `test $(cat
> > "$expensive_lock_" = "$owner")` and the `rm -f`, doesn't it?
> > 
> 
> Ah. That is true indeed. Though, without the re-check, makes overlaps after
> a SIGKILL more common: in a small stress test they went from about 3 per run
> to about 15. So, I kind of lean towards keeping it since it doesn't cost us
> much.

That's fine with me, but we should at least add a comment there that
mentions that this is _not_ a full fix for the race, and why that is
acceptable.

Patrick

  reply	other threads:[~2026-12-01 13:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  7:40 [PATCH] test-lib: run EXPENSIVE tests one at a time Kaartic Sivaraam
2026-11-19 10:07 ` Patrick Steinhardt
2026-11-19 17:12   ` Kaartic Sivaraam
2026-11-19 17:29 ` [PATCH v2] " Kaartic Sivaraam
2026-11-19 17:33   ` Kaartic Sivaraam
2026-11-20  6:28   ` Junio C Hamano
2026-11-24 13:34     ` Kaartic Sivaraam
2026-11-25 20:21       ` Junio C Hamano
2026-11-27 13:59         ` Kaartic Sivaraam
2026-11-27 18:34           ` Junio C Hamano
2026-11-25 19:09   ` Harald Nordgren
2026-11-27 17:23 ` [PATCH v3] " Kaartic Sivaraam
2026-11-27 20:46   ` Junio C Hamano
2026-11-28  8:06     ` Kaartic Sivaraam
2026-11-28 14:57 ` [PATCH v4 0/2] test-lib: serialize EXPENSIVE tests to avoid OOM in CI Kaartic Sivaraam
2026-11-28 14:57   ` [PATCH v4 1/2] test-lib: run EXPENSIVE tests one at a time Kaartic Sivaraam
2026-11-29 16:55     ` Junio C Hamano
2026-11-30 14:13     ` Christian Couder
2026-12-01 10:14       ` Kaartic Sivaraam
2026-12-01 11:10         ` Christian Couder
2026-12-01 12:34           ` Kaartic Sivaraam
2026-12-01  7:22     ` Patrick Steinhardt
2026-12-01  8:47       ` Kaartic Sivaraam
2026-12-01 11:07         ` Patrick Steinhardt
2026-12-01 12:50           ` Kaartic Sivaraam
2026-12-01 13:19             ` Patrick Steinhardt [this message]
2026-11-28 14:58   ` [PATCH v4 2/2] t0000: test taking over and releasing the EXPENSIVE lock Kaartic Sivaraam
2026-12-01  7:23     ` Patrick Steinhardt
2026-12-01  8:49       ` Kaartic Sivaraam
2026-12-01 19:53 ` [PATCH v5] test-lib: run EXPENSIVE tests one at a time Kaartic Sivaraam

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=aw7JdcNAxOAIQpjH@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=haraldnordgren@gmail.com \
    --cc=kaartic.sivaraam@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