OpenSSH and non-blocking mode
djm at mindrot.org
Thu Jul 7 09:49:30 EST 2005
Larry Jones wrote:
> Dear OpenSSH developers,
> OpenSSH setting non-blocking mode on its standard files creates serious
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
> $ cat bigfile | wc -c
> $ (ssh localhost sleep 120& sleep 3; cat bigfile) | wc -c
> cat: stdout: Resource temporarily unavailable
What platform are you using? This works fine on OpenBSD and Solaris.
You could be running into a kernel bug.
> I understand the necessity to keep ssh from blocking in order to keep
> port-forwarding working, but wouldn't it be possible to do that by just
> selecting for write before trying to write to stdout or stderr rather
> than setting non-blocking mode?
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.
So unless you are willing to do your IO one byte at a time, select()ing
for each byte, you can still block.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the openssh-unix-dev