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

Re: What's cooking in git.git (Sep 2021, #08; Mon, 27)

From
Jeff King <peff@peff.net>
Date
Sep 28, 2021, 23:49 UTC
Message-ID
<YVOqJTU5HmnXlC5P@coredump.intra.peff.net>
In-Reply-To
<YVOn3hDsb5pnxR53@coredump.intra.peff.net>
On Tue, Sep 28, 2021 at 07:40:14PM -0400, Jeff King wrote:
Show 13 quoted lines
> but then fsck shows that our cache is corrupted:
> 
>   Checking object directories: 100% (256/256), done.
>   error: refs/notes/textconv/foo: invalid sha1 pointer 1e9b3ecffca73411001043fe914a7ec0e7291043
>   error: refs/notes/textconv/foo: invalid reflog entry 1e9b3ecffca73411001043fe914a7ec0e7291043
>   dangling tree 569b6e414203d2f50bdaafc1585eae11e28afc37
> 
> Now I'll admit the textconv-cache is a pretty seldom-used feature. And
> that there _probably_ aren't a lot of other ways that the diff code
> would try to write objects or references. But I think it speaks to the
> kind of subtle interactions we should worry about (and certainly
> corrupting the repository is a pretty bad outcome, though at least in
> this case it's "just" a cache and we could blow away that ref manually).

I haven't looked at the way the bulk-fsync code uses tmp_objdir at all yet, but this is the same kind of thing to be watching out for. I've added Neeraj to the cc. The full reproduction showing the problem with Elijah's patch is in the replied-to mail:

  https://lore.kernel.org/git/YVOn3hDsb5pnxR53@coredump.intra.peff.net/

The batch-fsync stuff might be OK in that the goal there is presumably not to throw away the result, but to eventually migrate it into the odb. So the unintended interaction to look out for there might be more like:

  - some code foo() wants to write a bunch of objects; it opens up a
    tmp_objdir to batch them
  - some other code bar() deep in the call-stack wants to write an
    object for whatever reason (maybe it's a caching textconv). Its
    object ends up in the tmp_objdir, too.
  - bar() writes a ref pointing to the object's oid, thinking it has
    fully written the object.
  - foo() encounters an error and aborts, rolling back the tmp_objdir,
    including the object written by bar(). Now our ref is corrupt.

As I said, I haven't looked at how the bulk-fsync stuff uses tmp_objdir. But if it's doing the same "globally all object writes go to the tmpdir" then it's at risk of this sort of thing.

-Peff
Previous: Jeff KingNext: Neeraj Singh
Message 22 of 40 in “What's cooking in git.git (Sep 2021, #08; Mon, 27)”
  1. Junio C HamanoSep 28, 2021
  2. Ævar Arnfjörð BjarmasonSep 28, 2021
  3. Junio C HamanoSep 28, 2021
  4. Elijah NewrenSep 28, 2021
  5. Ævar Arnfjörð BjarmasonSep 28, 2021
  6. Junio C HamanoSep 28, 2021
  7. Neeraj SinghSep 28, 2021
  8. Junio C HamanoSep 28, 2021
  9. Neeraj SinghSep 28, 2021
  10. Junio C HamanoOct 7, 2021
  11. Elijah NewrenOct 8, 2021
  12. Neeraj SinghOct 8, 2021
  13. Junio C HamanoOct 8, 2021
  14. Ævar Arnfjörð BjarmasonSep 28, 2021
  15. Junio C HamanoSep 28, 2021
  16. Derrick StoleeSep 28, 2021
  17. Junio C HamanoSep 28, 2021
  18. Derrick StoleeSep 28, 2021
  19. Junio C HamanoSep 28, 2021
  20. Elijah NewrenSep 29, 2021
  21. Jeff KingSep 28, 2021
  22. Jeff KingSep 28, 2021
  23. Neeraj SinghSep 29, 2021
  24. Jeff KingSep 30, 2021
  25. Elijah NewrenOct 1, 2021
  26. Junio C HamanoOct 1, 2021
  27. Neeraj SinghOct 1, 2021
  28. Elijah NewrenOct 1, 2021
  29. Elijah NewrenOct 1, 2021
  30. Junio C HamanoOct 1, 2021
  31. Elijah NewrenOct 1, 2021
  32. Elijah NewrenOct 4, 2021
  33. da/difftool (was: Re: What's cooking in git.git (Sep 2021, #08; Mon, 27))Ævar Arnfjörð Bjarmason, Sep 28, 2021
  34. ns/batched-fsync & en/remerge-diff (was Re: What's cooking in git.git (Sep 2021, #08; Mon, 27))Ævar Arnfjörð Bjarmason, Sep 28, 2021
  35. sg/test-split-index-fix (was Re: What's cooking in git.git (Sep 2021, #08; Mon, 27))Ævar Arnfjörð Bjarmason, Sep 28, 2021
  36. hn/reftable (Re: What's cooking in git.git (Sep 2021, #08; Mon, 27))Ævar Arnfjörð Bjarmason, Sep 28, 2021
  37. Han-Wen NienhuysSep 28, 2021
  38. Carlo ArenasSep 30, 2021
  39. Fabian StelzerSep 29, 2021
  40. Junio C HamanoSep 30, 2021

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.