We're running version 0.10 of Net::SFTP and version 1.29 of Net::SSH::Perl. The server we're connecting to is a "220.127.116.11 SSH Tectia Server", with protocol version 2.0.
When small files are transferred Net::SFTP works perfectly. When they get larger than a few kilobytes they hang at this point:
sftp: Sending SSH2_FXP_INIT
sftp: Remote version: 3
sftp: Sent SSH2_FXP_OPEN I:0 P: "filename"
sftp: Sent message T:17 I:1
sftp: Received stat reply T:105 I:1
sftp: Sent message SSH2_FXP_WRITE I:2 O:0
That's in the "do_write" procedure. So we've been trying different things to figure out what's wrong, and one thing that worked is to change the value of COPY_SIZE in SFTP.pm from 8192 to something lower (4063 and lower seem to make it work).
Does anyone have an idea why this is happening and why changing COPY_SIZE fixed it? Below is the test script we're using: