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

Joerg Vehlow lkml@jv-coder.de
Tue May 4 12:35:48 CEST 2021


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...

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.

Jörg


More information about the ltp mailing list