Deepdive into libssh2
This number -43
is an error code that comes directly from libssh2
, specifically LIBSSH2_ERROR_SOCKET_RECV
. The Failed getting banner
message is the dynamic error message that accompanies the error code. These two pieces of information give the location where this error is thrown, namely in the receive_banner
.
Underlying problem
It was the result of the socket throwing a receive error when libssh2
tried to read from it as part of initialising your SSH session. Either the server is misconfigured and is not sending a banner or the underlying connection disconnected for some reason.
Solution
The best course of action seems to have adequate retrying in place for these kinds of errors. You are connecting to a network which is an action that can fail. As the number of servers you are connecting to increases, you are going to run into errors that are a result of the underlying network. Adequate error handling is your best course of action.
You can find how to set exception handlers from the PHP docs.