Rclone SSH connection issue

I am trying 1000+ servers to pull data from a corporate server (Linux) using Rclone, I have written a powershell wrapper as schedule task which uses Rclone to check files existing, then looks for size, then pulls files, then deletes files from corporate server, For all these actions its making multiple SSH connects and I am getting following error
"NewFs: couldn't connect SSH: ssh: handshake failed: read tcp Ipaddres of local server:57345->IP addr of corporate linux server:22: wsarecv: An existing connection was forcibly closed by the remote host."
Please help how to resolve this error

That means the other side closed the connection.

So it could be firewall, ratelimiting or something like that. Could you have overloaded the remote server?

Maybe you should use rclone rcd then use the remote control api to do your work - this will re-use ssh connections.

Sorry for late response. Thanks for the reply Nick, We found that its SSHD maxstartup connections configuration issue, by default its only accepting 10 maxstartup, I also tried looking checkers and transfers parameter, However I have few questions

  1. When I see Rclone debug log, it always says 12 go routines active, Does that mean it uses 8 ssh connections for checkers and 4 for Transfers?
  2. I tried using "--checkers" "3" "--transfers" "1" , However I still see 12 go routines active, Would there be any configuration parameter where I can mention to use less ssh connections?
  3. Would like to know what max number we can go for maxstartup connections in SSHD config settings in a Redhat linux. Currently we are using 10000:10:15000. Since we are trying to send huge number of files to different destination servers. We are still seeing "ssh subsystem request failed" for some connections. Tried reaching Redhat support, they said they are not sure about Rclone (kind of escaping).

Rclone uses go routines for other things too, so probably not.

I think the 12 go routines is a red herring.

If you go above 65536 you'll run out of local ports. So keep it below there. Otherwise I think it is mostly down to resource usage and the most important will probably be memory. So I'd try to measure how much memory each new connection takes and set the limit like that.

Did you know rclone also can run an sftp server which you may find interesting.