Re: [PATCH] t5570: drop racy test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thomas & Peff,

On Thu, 20 Dec 2018, Jeff King wrote:

> On Thu, Dec 20, 2018 at 04:41:50PM +0000, Thomas Gummerer wrote:
> 
> > > That doesn't really fix it, but just broadens the race window. I dunno.
> > > Maybe that is enough in practice. We could do something like:
> > > 
> > >   repeat_with_timeout () {
> > > 	local i=0
> > > 	while test $i -lt 10
> > > 	do
> > > 		"$@" && return 0
> > > 		sleep 1
> > > 	done
> > > 	# no success even after 10 seconds
> > > 	return 1
> > >   }
> > > 
> > >   repeat_with_timeout grep -i extended.attribute daemon.log
> > > 
> > > to make the pattern a bit more obvious (and make it easy to extend the
> > > window arbitrarily; surely 10s is enough?).
> > 
> > I gave this a try, with below patch to lib-git-daemon.sh that you
> > proposed in the previous thread about this racyness.  That shows
> > another problem though, namely when truncating 'daemon.log' before
> > running 'git ls-remote' in this test, we're not sure all 'git deamon'
> > has flushed everything from previous invocations.  That may be an even
> > rarer problem in practice, but still something to keep in mind.
> 
> Right, that makes sense. Making this race-proof really does require a
> separate log stream for each test. I guess we'd need to be able to send
> git-daemon a signal to re-open the log (which actually is not as
> unreasonable as it may seem; lots of daemons have this for log
> rotation).
> 
> I think getting rid of the "cat" would also help a lot here.
> Unfortunately I think we use it not just for its "tee" effect, but also
> to avoid startup races by checking the "Ready to rumble" line. So again,
> we'd need some cooperation from git-daemon to tell us out-of-band that
> it has completed its startup (e.g., by touching another file).
> 
> > Dscho also mentioned on #git-devel a while ago that he may have a look
> > at actually making this test race-proof, but I guess he's been busy
> > with the 2.20 release.

And GitGitGadget. And working on the Azure Pipelines support. And
mentoring two interns.

This is what I still have in my internal ticket:

	Try to work around occasional t5570 failures in Git's test suite

	Seems that there is a race condition in
	https://github.com/git/git/blob/master/t/lib-git-daemon.sh#L48-L69
	that could possibly be solved by writing to the daemon.log
	directly, and showing the output only via `tail -f` (and only when
	running in verbose mode, as it simply won't make sense otherwise).

However, if the preferred route is to go ahead and just remove that test
altogether, I'm fine with that, too.

The only reason, in my mind, why we still have `git-daemon` is that it
allows for easy standing up your own Git server, e.g. as an ad-hoc way to
collaborate in a small ad-hoc team. If we ever get to the point where we
can stand up a minimal HTTP/HTTPS server with an internal Git command (not
requiring sysadmin privileges), from my point of view `git-daemon` can
even go the way of the Kale Island (but for much better reasons [*1*]).

> > I'm also not sure it's worth spending a lot of time trying to fix this
> > test, but I'd definitely be happy if someone proposes a different
> > solution.
> 
> Yeah. I'm sure it's fixable with enough effort, but I just think there
> are more interesting and important things to work on.
> 
> > --- >8 ---
> > Subject: [PATCH] t5570: drop racy test
> 
> So yeah, I'm still fine with this. But...
> 
> > ---
> >  t/t5570-git-daemon.sh | 13 -------------
> >  1 file changed, 13 deletions(-)
> 
> This is the only user of daemon.log, so we could drop those bits from
> lib-git-daemon.sh, too. That would also prevent people from adding new
> tests, thinking that this was somehow not horribly racy). I.e.,
> reverting 314a73d658 (t/lib-git-daemon: record daemon log, 2018-01-25).

Indeed, that would be good.

The only reason to keep daemon.log that I can think of is to make
debugging easier, but then, if it should become necessary, it is probably
easier to freopen() stdout or stderr into a file in `git daemon`, anyway.

Ciao,
Dscho

Footnote *1*: Kale Island, along with Rapita, Rehana, Kakatina and Zollies
is prominently featured in a scientific article at
http://iopscience.iop.org/article/10.1088/1748-9326/11/5/054011 that is on
my "important papers I read in 2018" list.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux