git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t5562: chunked sleep to avoid lost SIGCHILD

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 19, 2019, 18:38 UTC
Message-ID
<xmqq1s4339ow.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190218205028.32486-1-max@max630.net>
Max Kirillov <max@max630.net> writes:
Show 24 quoted lines
> If was found during stress-test run that a test may hang by 60 seconds.
> It supposedly happens because SIGCHILD was received before sleep has
> started.
>
> Fix by looping by smaller chunks, checking $exited after each of them.
> Then lost SIGCHILD would not cause longer delay than 1 second.
>
> Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
> Signed-off-by: Max Kirillov <max@max630.net>
> ---
> Submitting as proper patch. Note: I believe it does not relate to other issues
> discussed in this thread.
>  t/t5562/invoke-with-content-length.pl | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/t/t5562/invoke-with-content-length.pl b/t/t5562/invoke-with-content-length.pl
> index 0943474af2..257e280e3b 100644
> --- a/t/t5562/invoke-with-content-length.pl
> +++ b/t/t5562/invoke-with-content-length.pl
> @@ -29,7 +29,12 @@
>  }
>  print $out $body_data or die "Cannot write data: $!";
>  
> -sleep 60; # is interrupted by SIGCHLD

Ah, of course. If SIGCHLD interrupts, sets $existed in the handler, then we won't go back to sleep. But if the signal came before the sleep starts, we spend full 60 seconds here before we check $exited.

Makes sense.
Show 9 quoted lines
> +my $counter = 0;
> +while (not $exited and $counter < 60) {
> +        sleep 1;
> +        $counter = $counter + 1;
> +}
> +
>  if (!$exited) {
>          close($out);
>          die "Command did not exit after reading whole body";
Previous: Max Kirillov
Message 13 of 13 in “RE: [ANNOUNCE] Git v2.21.0-rc1 (NonStop Results)”
  1. Randall S. BeckerFeb 14, 2019
  2. Junio C HamanoFeb 14, 2019
  3. Johannes SchindelinFeb 14, 2019
  4. Randall S. BeckerFeb 14, 2019
  5. SZEDER GáborFeb 15, 2019
  6. Randall S. BeckerFeb 15, 2019
  7. Max KirillovFeb 15, 2019
  8. Randall S. BeckerFeb 15, 2019
  9. Max KirillovFeb 16, 2019
  10. t5562: chunked sleep to avoid lost SIGCHILDMax Kirillov, Feb 18, 2019
  11. Randall S. BeckerFeb 18, 2019
  12. Max KirillovFeb 18, 2019
  13. Junio C HamanoFeb 19, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.