https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228728

            Bug ID: 228728
           Summary: sh does not reap killed background processes until
                    terminal activity, creating zombies
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: b...@freebsd.org
          Reporter: mqu...@neosmart.net

The default `sh` shell does not reap backgrounded processes if sitting idle,
and killed backgrounded processes are not reaped until a new command is
executed or enter is pressed at the tty.

For example, 

```
$ cat
<CTRL-Z>
[1] + Suspended                     cat
$ 
```

Now in another terminal or in an SSH session:

```
$ killall -9 cat
```

The PID associated with cat is turned into a zombie as the shell does not reap
the killed instance. The only way to trigger reaping would be to attach to the
tty session where the process was initially backgrounded and hit <ENTER>:


```
$ cat
# resuming from first segment above 
$ <ENTER>
[1] Killed                          cat
$ 
```


Solution: `waitpid(2)` should be used to asynchronously detect the exit of
backgrounded child processes.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"

Reply via email to