linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "lizhijian@fujitsu.com" <lizhijian@fujitsu.com>
To: Kees Cook <keescook@chromium.org>
Cc: kernel test robot <lkp@intel.com>,
	"Li, Philip" <philip.li@intel.com>,
	"zhoujie2011@fujitsu.com" <zhoujie2011@fujitsu.com>,
	Shuah Khan <shuah@kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"andrea.righi@canonical.com" <andrea.righi@canonical.com>
Subject: ./kselftest/prefix.pl read from pipe will block until the front command and its child processes all exit
Date: Mon, 20 Dec 2021 07:48:09 +0000	[thread overview]
Message-ID: <78c1131a-532f-313d-3823-40e34421ac87@fujitsu.com> (raw)

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

                 reply	other threads:[~2021-12-20  7:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78c1131a-532f-313d-3823-40e34421ac87@fujitsu.com \
    --to=lizhijian@fujitsu.com \
    --cc=andrea.righi@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=philip.li@intel.com \
    --cc=shuah@kernel.org \
    --cc=zhoujie2011@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).