I'm running ssh
running on macOS to redirect connections to local Unix domain socket to a domain socket on another machine. The command line for ssh
call is roughly the following:
$ ssh -nNT -L /var/run/some.socket:/var/run/some.socket -o TCPKeepAlive=yes \
-o ServerAliveCountMax=10 -o ServerAliveInterval=60 user@destination
After performing some load testing, I discovered that on occasion some client connections fail, and upon examining logs, I found the following error output from ssh
at the same time that the connections fail:
channel 41: open failed: connect failed: open failed
channel 44: open failed: connect failed: open failed
channel 47: open failed: connect failed: open failed
channel 49: open failed: connect failed: open failed
channel 51: open failed: connect failed: open failed
channel 59: open failed: connect failed: open failed
channel 62: open failed: connect failed: open failed
channel 64: open failed: connect failed: open failed
The load test parameters are to run 100 concurrent connections (connect, send some data, receive some data, disconnect with total of 10,000 connections to be performed.)
The behavior observed is that at the beginning of the test when first set of connections are created very quickly, few connections fail with the above errors. How many fails ranges from run to run but usually between couple to a dozen or so. Most failures tend to happen at the beginning of the test, though at times occur later in the test (i.e. after first 100 had been made).
Other posts on SO with similar descriptions seem to be covering the issue of using localhost
with workaround to use 127.0.0.1
, which here makes it not relevant since it is not a TCP/IP socket. Also, the destination
part in the above command is specified as an IP address already.
A bit at a loss on how to fix and trace the issue. I tried using -vvv
to get detailed dumped of ssh
operation with nothing fruitful (all it logs for the relevant channels is that socket was set to non-blocking).
Note that the call to ssh
is done from a script, and the call is preceded with ulimit -n 1024
which should provide more than enough file descriptors to be available to service all the sockets.
ssh
is proceeded in the script by a callulimit -n 1024
. Updating the question to put that clarification and that it is on macOS