All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Cyril Hrubis <chrubis@suse.cz>
Cc: LTP List <ltp@lists.linux.it>, Martin Doucha <martin.doucha@suse.com>
Subject: Re: [LTP] 72b1728674 causing regressions [ [PATCH v2] Terminate leftover subprocesses when main test process crashes]
Date: Fri, 18 Feb 2022 15:42:06 +0100	[thread overview]
Message-ID: <Yg+wPtDfI4+bn1ww@pevik> (raw)
In-Reply-To: <Yg+UQM+YCmNU1ShF@yuki>

Hi Cyril,

> > Sometimes it's just a warning:

> I guess that it's a race between the SETSID() and exit(0) in the
> move_to_background() function. If the main test process calls exit(0)
> before the newly forked child managed to do SETSID() it's killed by the
> test library because it's still in the old process group.

Thanks!  Yep, it'll probably be a race.

Your patch causes server being killed:
tst_test.c:1511: TBROK: Test killed by SIGUSR1!

(no big surprise)

Also netstress server remains running:
netstress -D ltp_ns_veth1 -R 10 -B /tmp/LTP_tcp_ipsec.RZ6H3Adg4e

Kind regards,
Petr

> Try this:

> diff --git a/testcases/network/netstress/netstress.c b/testcases/network/netstress/netstress.c
> index 0914c65bd..04a850134 100644
> --- a/testcases/network/netstress/netstress.c
> +++ b/testcases/network/netstress/netstress.c
> @@ -713,11 +713,15 @@ static void server_cleanup(void)

>  static void move_to_background(void)
>  {
> -       if (SAFE_FORK())
> +       if (SAFE_FORK()) {
> +               pause();
>                 exit(0);
> +       }

>         SAFE_SETSID();

> +       SAFE_KILL(getppid(), SIGUSR1);
> +
>         close(STDIN_FILENO);
>         SAFE_OPEN("/dev/null", O_RDONLY);
>         close(STDOUT_FILENO);

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

  reply	other threads:[~2022-02-18 14:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-11 11:44 [LTP] [PATCH v2] Terminate leftover subprocesses when main test process crashes Martin Doucha
2022-02-11 12:55 ` Cyril Hrubis
2022-02-11 13:29   ` Martin Doucha
2022-02-12  3:03     ` Li Wang
2022-02-18 12:30       ` [LTP] 72b1728674 causing regressions [ [PATCH v2] Terminate leftover subprocesses when main test process crashes] Petr Vorel
2022-02-18 12:42         ` Cyril Hrubis
2022-02-18 14:42           ` Petr Vorel [this message]
2022-02-18 14:48             ` Cyril Hrubis
2022-02-18 15:32               ` Petr Vorel

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=Yg+wPtDfI4+bn1ww@pevik \
    --to=pvorel@suse.cz \
    --cc=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=martin.doucha@suse.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.
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.