git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Wood <phillip.wood123@gmail.com>
To: Junio C Hamano <gitster@pobox.com>,
	Phillip Wood via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Phillip Wood <phillip.wood@dunelm.org.uk>
Subject: Re: [PATCH] t4053: avoid race when killing background processes
Date: Fri, 11 Aug 2023 10:56:40 +0100	[thread overview]
Message-ID: <2d9e9b59-bf78-8470-0731-3cd7fe15a727@gmail.com> (raw)
In-Reply-To: <xmqqedkassng.fsf@gitster.g>

On 10/08/2023 18:40, Junio C Hamano wrote:
> "Phillip Wood via GitGitGadget" <gitgitgadget@gmail.com> writes:
 >
> While I can see that "kill" in the when-finished handler may or may
> not find the backgrounded process by the time it is run, and
> ignoring its exit status (hence keeping test_when_finished happy)
> would be a reasonable thing to do.  I can understand if this patch
> is to fix a different symptom, namely, when-finished handler
> sometimes fails and makes the test fail.
> 
> But I am not sure how this causes the test to "hang", 


This is only a fix for the test failure that Peff saw when running with 
--stress.

> which
> presumably is a symptom that somebody is trying to read from
> a pipe that nobody is making progress to write into?

That or a process blocking when tying to open a fifo seems the mostly 
likely cause but I can't see where that is happening. As you say this 
patch does not obviously change anything that would be causing the test 
to hang.

Best Wishes

Phillip

>  We will
> send a signal either way to the writers, and the only difference is
> that we ignore the exit code.
> 
> Granted, when-finished handlers are concatenated with "&&-", and one
> "kill"s failure will cause the other "kill" not to run, so we may
> send a signal to only one but not to the other, but that should all
> happen after "diff --no-index" returns, so it still does not explain
> the "hang".
> 
> Puzzled...

>> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1571%2Fphillipwood%2Fdiff-no-index-pipes-fixes-v1
>> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1571/phillipwood/diff-no-index-pipes-fixes-v1
>> Pull-Request: https://github.com/gitgitgadget/git/pull/1571
>>
>>   t/t4053-diff-no-index.sh | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/t/t4053-diff-no-index.sh b/t/t4053-diff-no-index.sh
>> index a28b9ff2434..1fb7d334620 100755
>> --- a/t/t4053-diff-no-index.sh
>> +++ b/t/t4053-diff-no-index.sh
>> @@ -248,11 +248,11 @@ test_expect_success PIPE,SYMLINKS 'diff --no-index reads from pipes' '
>>   	{
>>   		(test_write_lines a b c >old) &
>>   	} &&
>> -	test_when_finished "! kill $!" &&
>> +	test_when_finished "kill $! || :" &&
>>   	{
>>   		(test_write_lines a x c >new) &
>>   	} &&
>> -	test_when_finished "! kill $!" &&
>> +	test_when_finished "kill $! || :" &&
>>   
>>   	cat >expect <<-EOF &&
>>   	diff --git a/old b/new-link
>>
>> base-commit: a82fb66fed250e16d3010c75404503bea3f0ab61

  reply	other threads:[~2023-08-11  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 14:33 [PATCH] t4053: avoid race when killing background processes Phillip Wood via GitGitGadget
2023-08-10 17:40 ` Junio C Hamano
2023-08-11  9:56   ` Phillip Wood [this message]
2023-08-11 14:44     ` Jeff King
2023-08-11 15:47     ` Junio C Hamano

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=2d9e9b59-bf78-8470-0731-3cd7fe15a727@gmail.com \
    --to=phillip.wood123@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=phillip.wood@dunelm.org.uk \
    /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).