From: Jeff King <peff@peff.net>
To: Patrick Steinhardt <ps@pks.im>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] update-ref: fix streaming of status updates
Date: Wed, 15 Sep 2021 13:13:24 -0400 [thread overview]
Message-ID: <YUIptJNN5DxrkydV@coredump.intra.peff.net> (raw)
In-Reply-To: <1e9e62a2c5f74db91aaded83783076c28b757836.1630659922.git.ps@pks.im>
> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> index 4506cd435b..1e754e258f 100755
> --- a/t/t1400-update-ref.sh
> +++ b/t/t1400-update-ref.sh
> @@ -1598,6 +1598,38 @@ test_expect_success 'transaction cannot restart ongoing transaction' '
> test_must_fail git show-ref --verify refs/heads/restart
> '
>
> +test_expect_success PIPE 'transaction flushes status updates' '
> + mkfifo in out &&
> + (git update-ref --stdin <in >out &) &&
> +
> + exec 9>in &&
> + test_when_finished "exec 9>&-" &&
> +
> + echo "start" >&9 &&
> + echo "start: ok" >expected &&
> + read line <out &&
> + echo "$line" >actual &&
> + test_cmp expected actual &&
> +
> + echo "create refs/heads/flush $A" >&9 &&
> +
> + echo prepare >&9 &&
> + echo "prepare: ok" >expected &&
> + read line <out &&
> + echo "$line" >actual &&
> + test_cmp expected actual &&
I think this test may be racy. I saw a strange failure from it in CI:
https://github.com/peff/git/runs/3605506649?check_suite_focus=true#step:5:6734
I can't reproduce the problem locally with "--stress", but the failure
there is on macOS (and likewise, a nearby run failed with a timeout just
for macOS, which could be caused by a racy deadlock).
I'm guessing the problem may be the continued opening and closing of
"out" by the read calls from the shell. The update-ref process may get
SIGPIPE as a result, depending on the write timing.
The solution is to use open a descriptor for "out" like we do for "in",
and then read from that. See 4783e7ea83 (t0008: avoid SIGPIPE race
condition on fifo, 2013-07-12) for some prior art.
-Peff
next prev parent reply other threads:[~2021-09-15 17:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 9:06 [PATCH] update-ref: fix streaming of status updates Patrick Steinhardt
2021-09-03 18:34 ` Junio C Hamano
2021-09-15 17:13 ` Jeff King [this message]
2021-09-15 17:24 ` [PATCH] t1400: avoid SIGPIPE race condition on fifo Jeff King
2021-09-15 20:08 ` Junio C Hamano
2021-09-16 4:39 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YUIptJNN5DxrkydV@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).