./kselftest/prefix.pl read from pipe will block until the front command and its child processes all exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi folks, Kees

This issue confuses the LKP/0Day robot for a long time.
Take below script as an example:

lizj@FNSTPC:~/workspace/colo/linux/tools/testing/selftests$ cat a.sh
#!/bin/bash
sleep 10 &
echo 1000000000000000

lizj@FNSTPC:~/workspace/colo/linux/tools/testing/selftests$ time ./a.sh | ./kselftest/prefix.pl
# 1000000000000000

real    0m10.004s
user    0m0.012s
sys    0m0.001s
------------------------------------

Although the first script already exited,  ./kselftest/prefix.pl will block until "sleep 10 &" exit.
That means once some of the child process cannot finish/exit itself, for example, one test
becomes *zombie* for some reasons, the whole ksefltest framework will hang forever.

In addition,  currently ksefltest timeout scheme[1][2] will not signal/kil the child processes, that
make the blocking often happens.

Since i'm not familiar with perl, not sure whether it can finish itself *directly* when first/front
command(excluding child processes) exits.


[1]: https://lkml.org/lkml/2021/12/17/140
[2]: http://lkml.iu.edu/hypermail/linux/kernel/2004.1/02379.html
$ man timeout
        --foreground
               when not running timeout directly from a shell prompt,
               allow COMMAND to read from the TTY and get TTY signals; in this mode, children of COMMAND will not be timed out


Thanks
Zhijian




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux