Processes left unkilled (portable)

Danek Duvall duvall at emufarm.org
Sun Oct 28 10:37:37 EST 2001


I just came across this problem (on Linux, using OpenSSH 2.9.9p2).  Run

    ssh <host> "tail -f <file> | grep <regexp>"

Let it connect, and then hit ^C.  If you look on <host>, the tail
process has been orphaned, but grep, which was its parent, and a direct
child of sshd, is gone.

It appears that the immediate child of the sshd (grep) is sent a SIGTERM
(on line 1983 of session.c, in the function session_close_by_channel()),
but its child (tail) never finds out about that death, and stays happily
alive.

Killing the process group seems to work around the problem, but I
haven't actually tried doing that in the code by negating the child's
pid in the kill() statement, just killing the process group from the
commandline.

Is this actually a bug, or is it a desired feature?

Thanks,
Danek



More information about the openssh-unix-dev mailing list