OpenSSH and non-blocking mode
lawrence.jones at ugs.com
Thu Jul 7 10:25:02 EST 2005
Damien Miller writes:
> I don't think your analysis is correct: setting nonblock on one side of
> a stdio connection shouldn't affect the other side (see the attached
> test program).
The problem isn't that setting nonblock on one end of a pipe (or
socketpair or pty) sets nonblock on the other end (which is what your
test progam test) -- it does not. The problem is that other things can
be sharing the same end as ssh. Look again at my example:
$ (ssh localhost sleep 120& sleep 3; cat bigfile) | wc -c
The problem is not that ssh setting nonblock affects wc on the other end
of the pipe, the problem is that it affects cat, which is sharing the
same end of the pipe for stdout as ssh since they both inherited them
from the same shell (they're also sharing the same stderr for the same
> What platform are you using? This works fine on OpenBSD and Solaris.
> You could be running into a kernel bug.
No, it's not a kernel bug. I'm using BSD/OS, but I've had reports of
the problem on lots of other platforms.
> No - we cannot turn of non-blocking stdio in OpenSSH. select() will tell
> you that a fd is ready for writing, but not how much data you can write.
Drat. I was thinking you'd get a partial write in that case, but you
only get partial writes in non-blocking mode. Drat, drat, drat.
I've got more brains than I know what to do with. -- Calvin
More information about the openssh-unix-dev