bugzilla-daemon at bugzilla.mindrot.org
2009-Jun-10 18:29 UTC
[Bug 396] sshd orphans processes when no pty allocated
https://bugzilla.mindrot.org/show_bug.cgi?id=396 Marc Herbert <marc.herbert+mindrot at gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marc.herbert+mindrot at gmail. | |com --- Comment #14 from Marc Herbert <marc.herbert+mindrot at gmail.com> 2009-06-11 04:29:55 --- (In reply to comment #9)> Bug #52 is sshd waiting for descriptors to close on a clean shutdown. This one > is subprocesses not knowing that sshd (and thus their stdin/stdout) has gone > away on abnormal termination, usually because they don't check if their read() > calls on stdin return zero.People like me not comfortable with patching their ssh server can probably take advantage of this workaround I wrote. This is just a "EOF to SIGHUP" converter implemented in 4 lines of shell script (it simply inserts a "cat" between sshd and the no longer orphan process). TUBE=/tmp/myfifo.$$; mkfifo "$TUBE" <"$TUBE" yourApplicationIgnoringEOFMoreOftenThanNot & appPID=$! # unlike the above, cat WILL notice the EOF and politely die cat >"$TUBE" kill -HUP -$appPID; rm "$TUBE" Feedback is welcome; do not hesitate to email me. -- 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.
bugzilla-daemon at bugzilla.mindrot.org
2009-Jul-01 14:33 UTC
[Bug 396] sshd orphans processes when no pty allocated
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.
Maybe Matching Threads
- [Bug 396] New: sshd orphans processes when no pty allocated
- [Bug 396] sshd orphans processes when no pty allocated
- [Bug 396] sshd orphans processes when no pty allocated
- [Bug 396] sshd orphans processes when no pty allocated
- [Bug 396] sshd orphans processes when no pty allocated