git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "SZEDER Gábor" <szeder@ira.uka.de>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH] t5510: run auto-gc in the foreground
Date: Tue, 03 May 2016 01:55:26 +0200	[thread overview]
Message-ID: <20160503015526.Horde.e0uZ0P4BqpNnwx_zmhu3WfE@webmail.informatik.kit.edu> (raw)
In-Reply-To: <alpine.DEB.2.20.1605020859131.9313@virtualbox>


Quoting Johannes Schindelin <Johannes.Schindelin@gmx.de>:

> Hi Gábor,
>
> On Sun, 1 May 2016, SZEDER Gábor wrote:
>
>> diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh
>> index 38321d19efbe..454d896390c0 100755
>> --- a/t/t5510-fetch.sh
>> +++ b/t/t5510-fetch.sh
>> @@ -682,6 +682,7 @@ test_expect_success 'fetching with auto-gc does
>> not lock up' '
>> 	(
>> 		cd auto-gc &&
>> 		git config gc.autoPackLimit 1 &&
>> +		git config gc.autoDetach false &&
>> 		GIT_ASK_YESNO="$D/askyesno" git fetch >fetch.out 2>&1 &&
>> 		! grep "Should I try again" fetch.out
>> 	)
>
> Sounds good to me.

There is something still bothering me, though.

I take this was a Windows-specific issue; deleting open files on Linux is
no brainer.  According to a comment on the original Git for Windows issue
at github[1], 'git gc' runs in the background by default on Windows as well.

Now, it's 'git gc --auto' that's trying to delete pack and index files that
became redundant after repacking, and when it can't delete those files,
then complains.  I.e. those "Should I try again" questions the test looks
for come from 'git gc', not from 'git fetch'.  So far so good.

Let's assume that someone inconsiderately removes that closed_all_pack()
call added to cmd_fetch(), basically reverting the fix in 0898c9628104.
The test added in the same commit (i.e. not including my fix here) should
still be able to catch it, but I think it's possible that it sometimes
remains unnoticed. Consider the following sequence:

    1. 'git fetch' does its thing, including opening pack and index files.
    2. 'git fetch' launches 'git gc --auto' which then goes into background.
    3. The scheduler happens to decide that it's 'git fetch's turn again,
       and it finishes, including closing all opened pack and index files.
    4. 'git gc' gets a chance to proceed, repacks and then manages to delete
       all redundant pack and index files successfully.
    5. 'grep' doesn't find the string it looks for.
    6. The test succeeds.

And the background 'git gc --auto' doesn't even have to be delayed that
long, because 'git fetch' exits immediately after launching it.  That's
considerably shorter than the delay necessary for the 'rm -rf' error I
described in the commit message, because for the latter 'git fetch' must
finish, 'grep' must run, and 'test_done' must write the test results and
start 'rm -rf $trash' while 'git gc' is still running in the background.

So, if I'm right, then my fix is not just about avoiding a sporadic error
from the test harness, but it's also important for the test's
correctness.  But am I right?  Alas I don't have a Git for Windows dev
environment to play around with this.

[1] - https://github.com/git-for-windows/git/issues/500#issuecomment-149933531


Gábor


> Alternatively, we could consider passing `-c gc.autoDetach=false` instead,
> to limit the scope. I am not insisting on it, of course ;-)
>
> Ciao,
> Dscho

  reply	other threads:[~2016-05-02 23:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-01 15:37 [PATCH] t5510: run auto-gc in the foreground SZEDER Gábor
2016-05-02  7:01 ` Johannes Schindelin
2016-05-02 23:55   ` SZEDER Gábor [this message]
2016-05-03 11:50     ` SZEDER Gábor
2016-05-04  5:48       ` Johannes Schindelin
2016-05-05 15:14         ` SZEDER Gábor
2016-05-05 15:16           ` [RFC PATCH] gc --auto: don't lie about running in background on Windows SZEDER Gábor
2016-05-05 16:28             ` Junio C Hamano
2016-05-07 14:44               ` SZEDER Gábor

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=20160503015526.Horde.e0uZ0P4BqpNnwx_zmhu3WfE@webmail.informatik.kit.edu \
    --to=szeder@ira.uka.de \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).