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

Re: [PATCH v2 3/4] packfile: recover object lookups racing a concurrent repack

From
Elijah Newren <newren@gmail.com>
Date
Aug 27, 2026, 22:23 UTC
Message-ID
<CABPp-BEmReAR-f-aweM=f=5QhRPxG1K-KLTsbyRt2aDQD_QnVA@mail.gmail.com>
In-Reply-To
<20260827055743.GB189659@coredump.intra.peff.net>
On Wed, Aug 26, 2026 at 10:57 PM Jeff King <peff@peff.net> wrote:
Show 29 quoted lines
>
> On Tue, Aug 25, 2026 at 07:00:28PM +0000, Elijah Newren via GitGitGadget wrote:
>
> >   1. open_pack_index() fails, so we print
> >
> >         error: packfile <path> index unavailable
> >
> >      and report the pack as unusable, even though the object still lives
> >      in the replacement pack.
> >
> >   2. A normal lookup recovers: odb_read_object_info_extended() issues a
> >      second read that reloads the on-disk pack state and finds the object
> >      in its new home, making the message above mere noise.  But an
> >      OBJECT_INFO_QUICK lookup deliberately skips that second read to stay
> >      fast on a genuine miss, so it does *not* recover: it reports the
> >      object as absent even though it still lives in the replacement pack.
> >      A resident reader that resolves objects with a QUICK lookup -- such
> >      as the `git mktree --batch` process the tests below drive -- then
> >      produces wrong results.  Even where a spurious miss is not fatal it
> >      is not harmless: `git upload-pack` checks a client's "have" lines
> >      with a QUICK lookup, and a dropped "have" removes a common object
> >      from the negotiation, so the client is sent more than it needs.
>
> Maybe I am still being dense, but this description does not make any
> sense to me at all.
>
> The _point_ of QUICK is to accept those false negatives. It is the right
> thing for upload-pack to do, to avoid re-scans for objects which we
> simply don't have (and don't necessarily expect to have).
It's far more likely that I am the one being dense.  My rough line of thinking:
* We see "packfile ... index unavailable" in our logging
* There's only one thing that remove packfiles
* Investigate the mechanism
* Look for other affected callers (e.g. mktree --batch)
* Consider corrective measures

Steps 1-4 above are probably fine, and step 5 may have been where I went off the rails. My thinking there, wrong or right, was:

* It makes sense that we don't want to reprepare most of the time
* ...but _if_ we know of the existence of some specific packfile in
this process and that packfile has since disappeared by the time we go
to open or read it, is that a special case?  Should it be?
Show 9 quoted lines
> It sounds like mktree is wrong to be using QUICK at all. It comes from
> 817b0f6027 (mktree: do not check type of remote objects, 2022-06-21)
> which rewrote a call to vanilla oid_object_info(). From the description
> there it probably should be using SKIP_FETCH_OBJECT but not QUICK. Or
> possibly it should use neither unless --missing is given.
>
> So I don't see QUICK itself here violating any contract (even if it
> _could_ find the object in some cases with just a little more work, as
> in the case that we were discussing for v1).

I'll drop this patch and instead send a small mktree change that stops passing OBJECT_INFO_QUICK (keeping SKIP_FETCH_OBJECT), so mktree recovers via the normal reprepare like every other non-QUICK reader. That removes the packfile.c changes entirely, so both the reload-under-QUICK hack and the .idx/.pack raciness you noted in pack_index_is_missing() go away with them.

Previous: Jeff KingNext: Jeff King
Message 29 of 49 in “Objects treated as missing despite being present, due to race with geometric repacking”
  1. 0/2 Objects treated as missing despite being present, due to race with geometric repackingElijah Newren via GitGitGadget, Aug 18, 2026
  2. 1/2 replay: fail gracefully when a merge input is unreadableElijah Newren via GitGitGadget, Aug 18, 2026
  3. Junio C HamanoAug 19, 2026
  4. Elijah NewrenAug 21, 2026
  5. Junio C HamanoAug 21, 2026
  6. 2/2 packfile: recover when a multi-pack-index names a removed packElijah Newren via GitGitGadget, Aug 18, 2026
  7. Junio C HamanoAug 19, 2026
  8. Patrick SteinhardtAug 20, 2026
  9. Elijah NewrenAug 21, 2026
  10. Jeff KingAug 24, 2026
  11. Patrick SteinhardtAug 24, 2026
  12. Jeff KingAug 24, 2026
  13. Jeff KingAug 24, 2026
  14. Jeff KingAug 24, 2026
  15. Elijah NewrenAug 25, 2026
  16. Jeff KingAug 24, 2026
  17. Patrick SteinhardtAug 24, 2026
  18. Jeff KingAug 24, 2026
  19. Elijah NewrenAug 25, 2026
  20. Derrick StoleeAug 24, 2026
  21. Elijah NewrenAug 25, 2026
  22. Derrick StoleeAug 24, 2026
  23. 0/4 Objects treated as missing despite being present, due to race with geometric repackingElijah Newren via GitGitGadget, Aug 25, 2026
  24. 1/4 replay: fail gracefully when a merge input is unreadableElijah Newren via GitGitGadget, Aug 25, 2026
  25. 2/4 mktree: plug per-tree leak in --batch modeElijah Newren via GitGitGadget, Aug 25, 2026
  26. Jeff KingAug 27, 2026
  27. 3/4 packfile: recover object lookups racing a concurrent repackElijah Newren via GitGitGadget, Aug 25, 2026
  28. Jeff KingAug 27, 2026
  29. Elijah NewrenAug 27, 2026
  30. Jeff KingAug 29, 2026
  31. 4/4 packfile: recover when a multi-pack-index names a removed packElijah Newren via GitGitGadget, Aug 25, 2026
  32. Jeff KingAug 27, 2026
  33. Elijah NewrenAug 28, 2026
  34. Jeff KingAug 29, 2026
  35. 0/4 Objects treated as missing despite being present, due to race with geometric repackingElijah Newren via GitGitGadget, Aug 29, 2026
  36. 1/4 replay: fail gracefully when a merge input is unreadableElijah Newren via GitGitGadget, Aug 29, 2026
  37. 2/4 mktree: plug per-tree leak in --batch modeElijah Newren via GitGitGadget, Aug 29, 2026
  38. 3/4 mktree: do not use OBJECT_INFO_QUICK when checking objectsElijah Newren via GitGitGadget, Aug 29, 2026
  39. Jeff KingAug 29, 2026
  40. 4/4 packfile: recover when a multi-pack-index names a removed packElijah Newren via GitGitGadget, Aug 29, 2026
  41. Jeff KingAug 29, 2026
  42. Junio C HamanoAug 30, 2026
  43. Patrick SteinhardtAug 31, 2026
  44. Jeff KingAug 31, 2026
  45. Derrick StoleeSep 1, 2026
  46. Junio C HamanoSep 1, 2026
  47. Derrick StoleeSep 1, 2026
  48. Elijah NewrenSep 1, 2026
  49. Derrick StoleeSep 1, 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.