git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 1/2] test-lib: run EXPENSIVE tests one at a time

From
Patrick Steinhardt <ps@pks.im>
Date
Dec 1, 2026, 13:19 UTC
Message-ID
<aw7JdcNAxOAIQpjH@pks.im>
In-Reply-To
<3fba9f96-47e3-47c0-b540-92af0190fdc3@gmail.com>
On Tue, Dec 01, 2026 at 06:20:52PM +0530, Kaartic Sivaraam wrote:
Show 48 quoted lines
> 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
Previous: Kaartic SivaraamNext: Kaartic Sivaraam
Message 26 of 32 in “test-lib: run EXPENSIVE tests one at a time”
  1. test-lib: run EXPENSIVE tests one at a timeKaartic Sivaraam, Nov 19, 2026
  2. Patrick SteinhardtNov 19, 2026
  3. Kaartic SivaraamNov 19, 2026
  4. test-lib: run EXPENSIVE tests one at a timeKaartic Sivaraam, Nov 19, 2026
  5. Kaartic SivaraamNov 19, 2026
  6. Junio C HamanoNov 20, 2026
  7. Kaartic SivaraamNov 24, 2026
  8. Junio C HamanoNov 25, 2026
  9. Kaartic SivaraamNov 27, 2026
  10. Junio C HamanoNov 27, 2026
  11. Harald NordgrenNov 25, 2026
  12. test-lib: run EXPENSIVE tests one at a timeKaartic Sivaraam, Nov 27, 2026
  13. Junio C HamanoNov 27, 2026
  14. Kaartic SivaraamNov 28, 2026
  15. 0/2 test-lib: serialize EXPENSIVE tests to avoid OOM in CIKaartic Sivaraam, Nov 28, 2026
  16. 1/2 test-lib: run EXPENSIVE tests one at a timeKaartic Sivaraam, Nov 28, 2026
  17. Junio C HamanoNov 29, 2026
  18. Christian CouderNov 30, 2026
  19. Kaartic SivaraamDec 1, 2026
  20. Christian CouderDec 1, 2026
  21. Kaartic SivaraamDec 1, 2026
  22. Patrick SteinhardtDec 1, 2026
  23. Kaartic SivaraamDec 1, 2026
  24. Patrick SteinhardtDec 1, 2026
  25. Kaartic SivaraamDec 1, 2026
  26. Patrick SteinhardtDec 1, 2026
  27. 2/2 t0000: test taking over and releasing the EXPENSIVE lockKaartic Sivaraam, Nov 28, 2026
  28. Patrick SteinhardtDec 1, 2026
  29. Kaartic SivaraamDec 1, 2026
  30. test-lib: run EXPENSIVE tests one at a timeKaartic Sivaraam, Dec 1, 2026
  31. Patrick SteinhardtDec 3, 2026
  32. Kaartic SivaraamDec 3, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.