I have a script that executes a Rake remote task which executes once for each of two roles. Both roles are users on the same Vagrant instance. So essentially the task is opening two SSH connections to the same VM in parallel and executing some commands on each connection. I often find that when this task executes, it produces the following error:
ssh_exchange_identification: read: Connection reset by peer
However, this only happens on our Jenkins slave node, which is a Mac Mini. I've come up with a simple example that reproduces the connection reset behavior:
ssh root@vagrant-target "echo hello" & ssh root@vagrant-target "echo bye"
I've also found that executing the above command does not reproduce the error on my local MacBook Pro instance, which has the same Vagrant setup, even if I do it repeatedly.
Both machines have the same OS version, as well as the same version of SSH. I also ran the above ssh commands with -vvv but didn't see anything obvious. The only thing that comes to mind is that I see some sshd processes on the Jenkins machine, presumably used by Jenkins:
jenkins 34394 0.1 0.0 2471700 840 ?? S 6:27PM 0:00.05 /usr/sbin/sshd -i jenkins 35220 0.0 0.0 2470872 1284 ?? S 6:27PM 0:01.38 /usr/sbin/sshd -i root 35218 0.0 0.0 2469596 2908 ?? S 6:27PM 0:00.04 /usr/sbin/sshd -i
Does anyone have any ideas as to why this behavior would appear on one machine but not the other?