git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: "Torsten Bögershausen" <tboegi@web.de>
Cc: Git Mailing List <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: t5570 shaky for anyone ?
Date: Sun, 25 Nov 2018 23:22:47 +0100	[thread overview]
Message-ID: <20181125222247.GD30222@szeder.dev> (raw)
In-Reply-To: <9d4e5224-9ff4-f3f8-519d-7b2a6f1ea7cd@web.de>

On Sun, Nov 25, 2018 at 09:52:23PM +0100, Torsten Bögershausen wrote:
> After running the  "Git 2.20-rc1" testsuite here on a raspi,
> the only TC that failed was t5570.
> When the "grep" was run on daemon.log, the file was empty (?).
> When inspecting it later, it was filled, and grep would have found
> the "extended.attribute" it was looking for.

I think I saw the same failure on Travis CI already before 2.19, so
it's not a new issue.  Here's the test's verbose output:

  + cat
  + 
  + GIT_OVERRIDE_VIRTUAL_HOST=localhost git -c protocol.version=1 ls-remote git://127.0.0.1:5570/interp.git
  b6752e52dd867264d12240028003f21e3e1dccab        HEAD
  b6752e52dd867264d12240028003f21e3e1dccab        refs/heads/master
  + cut -d  -f2-
  + grep -i extended.attribute daemon.log
  + test_cmp expect actual
  + diff -u expect actual
  --- expect      2018-06-12 10:06:50.758357927 +0000
  +++ actual      2018-06-12 10:06:50.774365936 +0000
  @@ -1,2 +0,0 @@
  -Extended attribute "host": localhost
  -Extended attribute "protocol": version=1
  [10579] Connection from 127.0.0.1:45836
  [10579] Extended attribute "host": localhost
  [10579] Extended attribute "protocol": version=1
  error: last command exited with $?=1
  [10579] Request upload-pack for '/interp.git'
  [10579] Interpolated dir '/usr/src/git/t/trash
  dir.t5570/repo/localhost/interp.git'
  [10462] [10579] Disconnected
  not ok 21 - daemon log records all attributes

The thing is that 'git daemon's log is not written to 'daemon.log'
directly, but it goes through a fifo, which is read by a shell loop,
which then sends all log messages both to 'daemon.log' and to the test
script's standard error.  So there is certainly a race between log
messages going through the fifo and the loop before reaching
'daemon.log' and 'git ls-remote' exiting and 'grep' opening
'daemon.log'.

> The following fixes it, but I am not sure if this is the ideal
> solution.

Currently this is the only test that looks at 'daemon.log', but if we
ever going to add another one, then that will be prone to the same
issue.

I wonder whether it's really that useful to have the daemon log in the
test script's output...  if the log was sent directly to daemon log,
then the window for this race would be smaller, but still not
completely closed.

Anyway, I added Peff to Cc, since he added that whole fifo-shell-loop
thing.

> diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
> index 7466aad111..e259fee0ed 100755
> --- a/t/t5570-git-daemon.sh
> +++ b/t/t5570-git-daemon.sh
> @@ -192,6 +192,7 @@ test_expect_success 'daemon log records all attributes' '
>  	GIT_OVERRIDE_VIRTUAL_HOST=localhost \
>  		git -c protocol.version=1 \
>  			ls-remote "$GIT_DAEMON_URL/interp.git" &&
> +	sleep 1 &&
>  	grep -i extended.attribute daemon.log | cut -d" " -f2- >actual &&
>  	test_cmp expect actual
>  '
> ----------------
> A slightly better approach may be to use a "sleep on demand":
> 
> +	( grep -i -q extended.attribute daemon.log || sleep 1 ) &&
> 

  parent reply	other threads:[~2018-11-25 22:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-25 20:52 t5570 shaky for anyone ? Torsten Bögershausen
2018-11-25 22:01 ` Thomas Gummerer
2018-11-26 16:42   ` Jeff King
2018-12-20 16:41     ` [PATCH] t5570: drop racy test Thomas Gummerer
2018-12-20 17:14       ` Jeff King
2018-12-21 15:48         ` Johannes Schindelin
2019-01-06 17:59           ` Thomas Gummerer
2019-01-06 17:53       ` [PATCH 2/1] Revert "t/lib-git-daemon: record daemon log" Thomas Gummerer
2019-01-07  8:20         ` Jeff King
2019-01-07 15:45           ` Junio C Hamano
2018-11-25 22:22 ` SZEDER Gábor [this message]
2018-11-26 16:45   ` t5570 shaky for anyone ? Jeff King

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181125222247.GD30222@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=tboegi@web.de \
    /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.
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 NNTP newsgroup(s).