[LTP] 72b1728674 causing regressions [ [PATCH v2] Terminate leftover subprocesses when main test process crashes]

Petr Vorel pvorel@suse.cz
Fri Feb 18 15:42:06 CET 2022


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);


More information about the ltp mailing list