ssh client is setting O_NONBLOCK on a pipe shared with other processes

Damien Miller djm at
Mon Sep 16 12:20:21 AEST 2019

On Sun, 15 Sep 2019, Doug Graham wrote:

> The quick summary is that we invoke git from a parallel invocation of
> "make".  Git invokes ssh to pull stuff from a remote repo. Ssh sets
> O_NONBLOCK on stdout and stderr if they do not refer to a tty. During
> our build, stderr refers to a pipe that other jobs run by make (and
> make itself) may also write to, and since this is a parallel build,
> they may write to that pipe while ssh has it in non-blocking mode.
> Make occasionally gets an unexpected EAGAIN error and fails the build
> with the error message "make: write error".
> We have a workaround, but it seems to me that this could cause
> problems with other background uses of ssh too.  Should ssh really be
> setting O_NONBLOCK if it is running non-interactively?

ssh has to set NONBLOCK otherwise it can, well, block - there's
no way for ssh to know a priori how much data it can write to a fd.


More information about the openssh-unix-dev mailing list