[LTP] [RFC] Shell API timeout sleep orphan processes

Petr Vorel pvorel@suse.cz
Tue May 4 17:07:16 CEST 2021


Hi Joerg,

> Hi Petr,

> > > > > The only way to fix this really portable I can think of is moving the
> > > > > timeout code (including the logic in _tst_kill_test) into c code. This way
> > > > > there would only be one binary, that can be killed flawlessly.
> > > > Maybe set -m would be enough. But sure, rewriting C is usually the best approach
> > > > for shell problems, we use quite a lot of C helpers for shell already.
> > > I will send the patch, if this introduces any new issues, we can still
> > > switch to a c based implementation.
> > Thank you!

> I guess I will not submit the fix with set -m...
> My colleague working testing on a new target just ran into a problem with
> out fix using set -m.
> For busybox sh, it only works, if a tty is allocated, otherwise it refuses
> to enable job monitor mode and the whole construct fails...
OK, C will be needed (unless anybody has an idea how to safely implement it in
shell).

> Since using the monitor mode only exploits the side effect, that it creates
> a process group and we already found a first issue, I think the only
> solution is switching to a c-based solution for the timeout stuff.
> Personally I like that it is written in shell script, but I see no other
> option to do it in pure shell. There is no builtin way, to create a process
> group and just redirecting the output of sleep to null does not seem to be a
> very good solution to me, because there would still be a lot of orphans
> around.

There will be git freeze in very soon, so I guess the fix won't make it to the
release (unless you have time to work on it next week).

Kind regards,
Petr


More information about the ltp mailing list