lkml.org 
[lkml]   [2021]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject./kselftest/prefix.pl read from pipe will block until the front command and its child processes all exit
Date
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
\
 
 \ /
  Last update: 2021-12-20 09:00    [W:0.041 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site