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

Re: [PATCH] fetch-pack: ignore SIGPIPE when writing to index-pack

From
Jeff King <peff@peff.net>
Date
Nov 19, 2021, 22:32 UTC
Message-ID
<YZgl5qYbAyAsixmo@coredump.intra.peff.net>
In-Reply-To
<xmqqy25jokft.fsf@gitster.g>
On Fri, Nov 19, 2021 at 02:21:58PM -0800, Junio C Hamano wrote:
Show 14 quoted lines
> Jeff King <peff@peff.net> writes:
> 
> > When fetching, we send the incoming pack to index-pack (or
> > unpack-objects) via the sideband demuxer. If index-pack hits an error
> > (e.g., because an object fails fsck), then it will die immediately. This
> > may cause us to get SIGPIPE on the fetch, as we're still trying to write
> > pack contents from the sideband demuxer (which is typically a thread,
> > and thus takes down the whole fetch process).
> 
> So, ... we'd die anyway and won't update the refs and anything that
> leaves permanent damage to the repository either way, but we choose
> a better way to die by not taking SIGPIPE, but to get an error from
> one of the write()s or the final close(), which will lead us to more
> "controlled" death using the normal error path?

Yes, exactly. We'll be exiting either way; it's just a matter of racily changing the exit code and possibly the error message from the parent fetch process.

So I do doubt this really hurts users much in practice, but making the tests robust seems worth it to me (because I found it after tracking down a flaky test failure). And because it _is_ a race in the code, I fixed it there rather than papering over the SIGPIPE exit in the test script.

-Peff
Previous: Junio C Hamano
Message 3 of 3 in “fetch-pack: ignore SIGPIPE when writing to index-pack”
  1. fetch-pack: ignore SIGPIPE when writing to index-packJeff King, Nov 19, 2021
  2. Junio C HamanoNov 19, 2021
  3. Jeff KingNov 19, 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.