[Bug 396] sshd orphans processes when no pty allocated

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Thu Jul 2 00:33:15 EST 2009


https://bugzilla.mindrot.org/show_bug.cgi?id=396





--- Comment #15 from Marc Herbert <marc.herbert+mindrot at gmail.com>  2009-07-02 00:33:14 ---
(In reply to comment #14)
>(it simply inserts a "cat" between sshd and the no longer orphan process).

Ahem, except sshd seems to create standard input in non-blocking mode,
which makes cat intermittently fail:

  cat: -: Resource temporarily unavailable

See this discussion:
http://lists.mindrot.org/pipermail/openssh-unix-dev/2005-July/023090.html

I initially used a recent ssh version 5.1 and did NOT hit this
non-blocking problem. Then I tried to use my cat trick with ssh version
3.4 and version 4.3 and DID intermittently hit this non-blocking
problem. Could this be due to version 5.1 now passing 3 pipes for
stdin/out/err as opposed to a socketpair in earlier versions?


Anyway, I switch to using socat instead of cat, and socat seems to deal
with non-blocking stdin in a more robust fashion. Here is the updated
workaround:

TUBE=/tmp/myfifo.$$; mkfifo "$TUBE"
<"$TUBE"   yourApplicationIgnoringEOFMoreOftenThanNot   &  appPID=$!
# unlike the above, socat WILL notice the EOF and politely die
socat -u STDIN "PIPE:$TUBE"
kill -HUP -$appPID; rm "$TUBE"

-- 
Configure bugmail: https://bugzilla.mindrot.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are watching the reporter.


More information about the openssh-bugs mailing list