All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH] test_children_cleanup.sh: Fix race condition
Date: Tue, 15 Feb 2022 08:34:28 +0100	[thread overview]
Message-ID: <YgtXhDRi0/U9nc4Z@pevik> (raw)
In-Reply-To: <CAEemH2c=+3_HBez0Pn6Yyx+v4PXJpwD3HZtPt87BR6AohtKvUw@mail.gmail.com>

Hi all,

...
> It doesn't work for all platforms and we can not guarantee how long it will
> cost before PID 1 reaps zombie process.

> Also, I just get to know that  Docker does not run processes under a
> special init process that properly reaps child processes, so that it is
> possible for the container to end up with zombie processes that cause
> all sorts of trouble.

> I even try adding `kill -SIGCHLD 1` but does not work as expected.

> See CI jobs:
>   https://github.com/wangli5665/ltp/runs/5194270998?check_suite_focus=true
> <https://mail.google.com/mail/u/1/%E2%80%8Bhttps://github.com/wangli5665/ltp/runs/5194270998?check_suite_focus=true>

> Therefore, I suggest giving a chance to my refined patch V2 :).

> --- a/lib/newlib_tests/test_children_cleanup.sh
> +++ b/lib/newlib_tests/test_children_cleanup.sh
> @@ -10,10 +10,16 @@ rm "$TMPFILE"
>  if [ "x$CHILD_PID" = "x" ]; then
>         echo "TFAIL: Child process was not created"
>         exit 1
> +elif grep -q "Z (zombie)" /proc/$CHILD_PID/status; then
> +       echo "TPASS: Child process is in zombie state"
> +       exit 0
>  elif ! kill -s 0 $CHILD_PID &>/dev/null; then
>         echo "TPASS: Child process was cleaned up"
>         exit 0
>  else
>         echo "TFAIL: Child process was left behind"
> +       echo "cat /proc/$CHILD_PID/status"
> +       echo "---------------------------"
> +       cat /proc/$CHILD_PID/status
>         exit 1
>  fi

Li's approach LGTM.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-02-15  7:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-14 16:51 [LTP] [PATCH] test_children_cleanup.sh: Fix race condition Martin Doucha
2022-02-15  4:30 ` Li Wang
2022-02-15  7:34   ` Petr Vorel [this message]
2022-02-15  9:27   ` Martin Doucha
2022-02-15  9:39     ` Petr Vorel
2022-02-15  9:50       ` Li Wang

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=YgtXhDRi0/U9nc4Z@pevik \
    --to=pvorel@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.