Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Feb 2015 02:59:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 197608] timeout(1) does not handle zombie grandchildren
Message-ID:  <bug-197608-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197608

            Bug ID: 197608
           Summary: timeout(1) does not handle zombie grandchildren
           Product: Base System
           Version: 11.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: emaste@freebsd.org

Created attachment 152953
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=152953&action=edit
zombie demonstration

Attached is a zombie demonstration - it forks and the child immediately exits.
The parent sleeps for one second and does not wait() for the child's status. As
expected it terminates after 1 second:

joule% /usr/bin/time ./a.out
        1.02 real         0.00 user         0.00 sys

However, running under timeout(1) results in waiting for the timeout period to
expire:

joule% /usr/bin/time /timeout 10s ./a.out
       10.02 real         0.00 user         0.00 sys

It looks like the issue is that we collect only one child status (cpid =
wait(&status)), which happens to be the zombie from a.out (cpid != pid). We
then loop to sigsuspend() and get stuck until the timeout expires.

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-197608-8>