[Bug 197608] timeout(1) does not handle zombie grandchildren

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Feb 14 03:00:00 UTC 2015


            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 at FreeBSD.org
          Reporter: emaste at 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

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.

More information about the freebsd-bugs mailing list