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

Re: [PATCH] test: accept death by SIGPIPE as a valid failure mode

From
Lars Schneider <larsxschneider@gmail.com>
Date
Nov 5, 2015, 09:34 UTC
Message-ID
<457EAFF7-C649-4DEB-BB9E-E82851DC7F8A@gmail.com>
In-Reply-To
<20151105074730.GA6819@sigill.intra.peff.net>
Show 39 quoted lines
> On 05 Nov 2015, at 08:47, Jeff King <peff@peff.net> wrote:
> 
> On Fri, Oct 30, 2015 at 02:22:14PM -0700, Junio C Hamano wrote:
> 
>> On a local host, the object/history transport code often talks over
>> pipe with the other side.  The other side may notice some (expected)
>> failure, send the error message either to our process or to the
>> standard error and hung up.  In such codepaths, if timing were not
>> unfortunate, our side would receive the report of (expected) failure
>> from the other side over the pipe and die().  Otherwise, our side
>> may still be trying to talk to it and would die with a SIGPIPE.
>> 
>> This was observed as an intermittent breakage in t5516 by a few
>> people.
>> 
>> In the real-life scenario, either mode of death exits with a
>> non-zero status, and the user would learn that the command failed.
>> The test_must_fail helper should also know that dying with SIGPIPE
>> is one of the valid failure modes when we are expecting the tested
>> operation to notice problem and fail.
> 
> Sorry for the slow review; before commenting I wanted to dig into
> whether this SIGPIPE ambiguity was avoidable in the first place.
> 
> I think the answer is "probably not". We do call write_or_die() pretty
> consistently in the network-aware programs. So we could ignore SIGPIPE,
> and then we would catch EPIPE (of course, we convert that into SIGPIPE
> in many places, but we do not have to do so). But since the SIGPIPE
> behavior is global, that carries the risk of us failing to check a write
> against some other descriptor. It's probably not worth it.
> 
> Teaching the tests to handle both cases seems like a reasonable
> workaround. Changing test_must_fail covers a lot of cases; I wondered if
> there are other tests that would not want to silently cover up a SIGPIPE
> death. But I could not really think of a plausible reason.
> 
> So I think your patch is the best thing to do.
> 
> -Peff
Oh, I missed this email thread. I am still working on a stable Travis-CI integration and I ran into this issue a few times. I fixed it in my (not yet published) patch with an additional function "test_must_fail_or_sigpipe" that I've used for all tests affected by this issue. Modifying the "test_must_fail" function seemed too risky for me as I don't understand all possible implications. However, if you don't see a problem then this is fine with me.
- Lars
Previous: Jeff KingNext: Junio C Hamano
Message 8 of 9 in “[RFC] t5516 "75 - deny fetch unreachable SHA1, allowtipsha1inwant=true" flaky?”
  1. Lars SchneiderOct 24, 2015
  2. Fredrik MedleyOct 25, 2015
  3. Lars SchneiderOct 25, 2015
  4. Junio C HamanoOct 25, 2015
  5. Junio C HamanoOct 30, 2015
  6. test: accept death by SIGPIPE as a valid failure modeJunio C Hamano, Oct 30, 2015
  7. Jeff KingNov 5, 2015
  8. Lars SchneiderNov 5, 2015
  9. Junio C HamanoNov 5, 2015

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.