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

Re: [PATCH 0/4] Always release pack files before calling gc --auto

From
Jeff King <peff@peff.net>
Date
Jan 13, 2016, 17:52 UTC
Message-ID
<20160113175237.GA13139@sigill.intra.peff.net>
In-Reply-To
<cover.1452705584.git.johannes.schindelin@gmx.de>
On Wed, Jan 13, 2016 at 06:20:02PM +0100, Johannes Schindelin wrote:
Show 9 quoted lines
> These patches are companions to 786b150 (clone --dissociate: avoid
> locking pack files, 2015-10-06), triggered by a bug report to the Git
> for Windows project.
> 
> Johannes Schindelin (4):
>   fetch: release pack files before garbage-collecting
>   am: release pack files before garbage-collecting
>   merge: release pack files before garbage-collecting
>   receive-pack: release pack files before garbage-collecting

I think this is fine, but I noticed an almost-problem that I think is worth mentioning.

Closing packs can open up race conditions in some cases. I.e., we think we have an object in a particular pack, do some work on that basis, and then later find the pack to be inaccessible (due to somebody else running gc). If we keep the fd open, there's no race, but if we close it, we can't reopen it.

I think all of the cases here are fine, for two reasons:
  1. The new closing is right before the program would exit anyway, so
     there's no interesting work left to do (and obviously that's where
     we generally want to call "gc --auto", too)
  2. This type of race might only be an issue for pack-objects (or at least that's
     the only place I've seen it).  Most normal read_sha1_file() callers
     will happily re-scan the pack directory for the new packs upon
     finding that the old pack went away. But pack-objects peeks in the
     packfiles a little more intimately, and will record the actual pack
     and offset (for delta reuse).
     It _might_ also be possible to trigger this race using bitmaps,
     which are also pretty intimate with the packfile code. I'm not
     sure.
So I think this series is OK.
-Peff
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 6 of 7 in “Always release pack files before calling gc --auto”
  1. 0/4 Always release pack files before calling gc --autoJohannes Schindelin, Jan 13, 2016
  2. 1/4 fetch: release pack files before garbage-collectingJohannes Schindelin, Jan 13, 2016
  3. 2/4 am: release pack files before garbage-collectingJohannes Schindelin, Jan 13, 2016
  4. 3/4 merge: release pack files before garbage-collectingJohannes Schindelin, Jan 13, 2016
  5. 4/4 receive-pack: release pack files before garbage-collectingJohannes Schindelin, Jan 13, 2016
  6. Jeff KingJan 13, 2016
  7. Johannes SchindelinJan 13, 2016

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.