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

Re: [PATCH v3] lockfile: add PID file for debugging stale locks

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 5, 2026, 12:23 UTC
Message-ID
<aVutN543nceW0f8W@pks.im>
In-Reply-To
<20251227075025.GC2071715@coredump.intra.peff.net>
On Sat, Dec 27, 2025 at 02:50:25AM -0500, Jeff King wrote:
Show 38 quoted lines
> On Wed, Dec 24, 2025 at 12:24:13PM +0000, Paulo Casaretto via GitGitGadget wrote:
> 
> > For a lock file "foo.lock", the PID file is named "foo~pid.lock". The
> > tilde character is forbidden in refnames and allowed in Windows
> > filenames, which guarantees no collision with the refs namespace
> > (e.g., refs "foo" and "foo~pid" cannot both exist). The file uses a
> > simple key-value format ("pid <value>") following the same pattern as
> > Git object headers, making it extensible for future metadata.
> 
> FWIW, I like this approach, as the earlier collision possibilities in
> earlier iterations made me a bit uncomfortable.
> 
> But then I wondered...
> 
> > The feature is controlled via core.lockfilePid configuration, which
> > accepts per-component values similar to core.fsync:
> > 
> >   - none: Disable for all components (default)
> >   - all: Enable for all components
> >   - index, config, refs, commit-graph, midx, shallow, gc, other:
> >     Enable for specific components
> 
> Do we really need this complexity now? I can see reasons why a user
> might want to switch the feature on (because they want the extra pid
> debugging info) or off (because they do not want the extra filesystem
> operations or potential cleanup hassle of extra stale files).
> 
> But if the collision problems in the ref namespace are now solved, does
> anybody really care about turning it on just for particular subsystems?
> I'd think they would want all or nothing.
> 
> 
> Trying to devil's advocate myself: maybe somebody is concerned about
> filesystem overhead for frequently-written files like refs but not for
> others, like config? That feels unlikely to me, but at least possible.
> 
> But if we were to ditch the subsystem-granularity for config, then all
> of the extra LOCKFILE_* arguments here could just go away.

I tend to agree. Based on my own experience, references are by far the most likely subsystem where one may hit stale lockfiles, so the feature is most useful there. But at the same time, it's also the most expensive subsystem to enable this feature for because we write so many small files there.

Consequently, if anybody cares, they would most likely want to enable this feature for refs. And, if so, the impact on other subsystems would very likely be dwarfed by the refs overhead.

So my approach would be to enable this setting with only "true" and "false" as possible values initially. And if we ever get a use case where somebody would be helped by configuring this per subsystem we can extend the config to learn about subsystems.

But ultimately I don't care too strongly about this. If the author wants to keep the current approach I'm fine with that, too.

Patrick
Previous: Jeff KingNext: Paulo Casaretto via GitGitGadget
Message 20 of 36 in “lockfile: add PID file for debugging stale locks”
  1. lockfile: add PID file for debugging stale locksPaulo Casaretto via GitGitGadget, Dec 2, 2025
  2. D. Ben KnobleDec 2, 2025
  3. Torsten BögershausenDec 3, 2025
  4. Jeff KingDec 3, 2025
  5. Junio C HamanoDec 3, 2025
  6. Jeff KingDec 3, 2025
  7. Taylor BlauDec 3, 2025
  8. Patrick SteinhardtDec 5, 2025
  9. Jeff KingDec 5, 2025
  10. Taylor BlauDec 3, 2025
  11. lockfile: add PID file for debugging stale locksPaulo Casaretto via GitGitGadget, Dec 17, 2025
  12. Junio C HamanoDec 18, 2025
  13. Junio C HamanoDec 18, 2025
  14. Junio C HamanoDec 18, 2025
  15. Ben KnobleDec 18, 2025
  16. Patrick SteinhardtDec 18, 2025
  17. lockfile: add PID file for debugging stale locksPaulo Casaretto via GitGitGadget, Dec 24, 2025
  18. Junio C HamanoDec 25, 2025
  19. Jeff KingDec 27, 2025
  20. Patrick SteinhardtJan 5, 2026
  21. lockfile: add PID file for debugging stale locksPaulo Casaretto via GitGitGadget, Jan 7, 2026
  22. Junio C HamanoJan 8, 2026
  23. D. Ben KnobleJan 8, 2026
  24. lockfile: add PID file for debugging stale locksPaulo Casaretto via GitGitGadget, Jan 20, 2026
  25. Junio C HamanoJan 20, 2026
  26. Jeff KingJan 21, 2026
  27. Eric SunshineJan 21, 2026
  28. Johannes SixtJan 21, 2026
  29. Jeff KingJan 21, 2026
  30. Junio C HamanoJan 21, 2026
  31. Jeff KingJan 21, 2026
  32. Junio C HamanoJan 21, 2026
  33. lockfile: add PID file for debugging stale locksPaulo Casaretto via GitGitGadget, Jan 22, 2026
  34. Junio C HamanoJan 22, 2026
  35. Patrick SteinhardtFeb 6, 2026
  36. Junio C HamanoFeb 6, 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.