[LTP] [PATCH] test_children_cleanup: allow child zombied for a while

Li Wang liwang@redhat.com
Mon Feb 14 12:18:14 CET 2022


On Mon, Feb 14, 2022 at 6:40 PM Martin Doucha <mdoucha@suse.cz> wrote:

> On 13. 02. 22 5:28, Li Wang wrote:
> > diff --git a/lib/newlib_tests/test_children_cleanup.sh
> b/lib/newlib_tests/test_children_cleanup.sh
> > index 4b4e8b2f0..ec1a0d4fe 100755
> > --- a/lib/newlib_tests/test_children_cleanup.sh
> > +++ b/lib/newlib_tests/test_children_cleanup.sh
> > @@ -13,7 +13,13 @@ if [ "x$CHILD_PID" = "x" ]; then
> >  elif ! kill -s 0 $CHILD_PID &>/dev/null; then
> >       echo "TPASS: Child process was cleaned up"
> >       exit 0
> > +elif grep -q -E "Z|zombie" /proc/$CHILD_PID/status; then
> > +       echo "TPASS: Child process was in zombie state"
> > +       exit 0
>
> We're in a race condition here either way so reading the status procfile
> after checking whether the process still exists can result in failure
> even when the child was properly killed. I wrongly believed that
>

Ah yes. It is still possible to complete the zombie reclaim just before
doing the grep.



> `kill -s 0` would fail when the target process is a zombie because the
> manpage vaguely suggests that (see the description of ESRCH errno in the
> kill(2) manpage) but it turns out I was wrong again.
>
> I'll send a fix myself later today.
>

Thanks, I look forward to a better solution.


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20220214/79d87f46/attachment.htm>


More information about the ltp mailing list