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

Petr Vorel pvorel@suse.cz
Fri Feb 18 16:32:26 CET 2022


Hi Cyril,

> Hi!
> > > 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)

> Ah right, we have to set up a dummy handler for SIGUSR1 since default
> handler for SIGUSR1 will terminate the process.


Yep, with with adding it it works as expected.
(I wasn't sure if you plan to somehow align with the cleanup from tst_test.c,
which also uses SIGUSR1 for cleanup, but right we're masking it).

static void sig_handler(int sig LTP_ATTRIBUTE_UNUSED)
{
}

and setting it in setup()
SAFE_SIGNAL(SIGUSR1, sig_handler);

> Or set the .needs_checkpoints in the tst_test structure and use WAKE and
> WAIT pair to synchronize.
As signal handler works, I'd go for it unless this preferred.
Going to send proper patch.

I wonder if it's just netstress.c which suffers this problem.

Kind regards,
Petr


More information about the ltp mailing list