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

Doug Graham edougra at
Mon Sep 16 01:15:38 AEST 2019

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?

For more details, please see the thread on the git mailing list at


More information about the openssh-unix-dev mailing list