http://www.perlmonks.org?node_id=977155


in reply to Net::SFTP::Foreign frequent connection server stall

I would use scp over sftp as zentara suggests. If, however, 'future policies' means only sftp, then you'll have to figure out what the problem is:
  1. A code fragment showing what you're doing might be helpful
  2. You don't list the SSH command/version that you're using
  3. The latest version of Net::Sftp::Foreign is 1.74, and it looks like it should work with 5.8.8
  4. Are both client and server Solaris 5.9?
  5. I'm not sure what you're referring to by 'SFTP v 1.35'. Your client is your perl program. Is this the server version? There are lots of different servers around. Most also create log files
  6. Can you use the sftp client on the command line to reliably transfer the file?
  7. tcpdump/wireshark of a hanging transfer can at least tell you what's crapping out at the tcp level

fnord

Replies are listed 'Best First'.
Re^2: Net::SFTP::Foreign frequent connection server stall
by Anonymous Monk on Jun 20, 2012 at 15:45 UTC
    fnord / Illuminatus,

    2. "ssh -V" shows: Sun_SSH_1.1.1, SSH protocols 1.5/2.0, OpenSSL

    3. Good to know!!

    4. DataONTAP (NetApp OS)

    5. I initially looked at the version of the SFTP.pm, so I just put it in here. Prolly extra info...

    6. Yes, and one thing I forgot to mention is if I re-run the job, the sftp will go through. It also worked completely fine when ran daily on our test server. But also the same symptom on our dev box... (almost seems like it's only the first connection of the day, or maybe within 24hrs of last connection but it sounds ridiculous and I have no proof...)

    7. I wouldn't know how to do that, or if I can. Since, I'm in a corporation and peons don't have access to anything, much less production. I'm just not sure. I mean, for us, in order to install a new Perl module it's 2 layers removed and we HOPE we get a knowledgeable SA...
    my $ssherr = File::Temp->new or die "File::Temp->new failed"; open my $stderr_save, '>&STDERR' or die "unable to dump STDERR"; open STDERR, '>&'.fileno($ssherr); my $sftp = Net::SFTP::Foreign->new( host => $properties{RemoteHostName}, user => $rmtUser, password => $rmtPass , timeout => 10, more=> '-v' , queue_size => 16); open STDERR, '>&'.fileno($stderr_save); if ($sftp->error) { print "sftp error: ".$sftp->error."\n"; seek($ssherr, 0, 0); while (<$ssherr>) { print "captured stderr: $_"; } $endprogram = 1; } close $ssherr; if ($endprogram) { exit($endprogram); } if (!$sftp->setcwd($properties{RemoteDirPath})) { print "File Transfer - unable to change directory: " . $sftp->error; exit(1); } if (!$sftp->get($properties{RemoteFileName}, "$fileTo")) { print "File Transfer - get failed: " . $sftp->error; exit(1); }