I'm trying to copy thousands of files using Net::SSH2 (tried Net::SSH2::Perl before, see http://www.perlmonks.org/index.pl?node_id=765848 )

So far, I've tried three different approaches, none of them successful:

my $sftp = $ssh2->sftp
Fails after a few dozen, hundred or thousand iterations (the exact number varies greatly)

libssh2_sftp_init(ss->session) -> 0x9a641d8 (OK, proceed with file copy) libssh2_sftp_open_ex(sf->sftp, (char*)pv_file, len_file, l_flags, mode +, 0) -> 0x9ce1dd8 Net::SSH2::File::DESTROY Net::SSH2::SFTP::DESTROY Net::SSH2::SFTP::DESTROY freeing session libssh2_sftp_init(ss->session) -> 0x9a641d8 (OK, proceed with file copy) libssh2_sftp_open_ex(sf->sftp, (char*)pv_file, len_file, l_flags, mode +, 0) -> 0x9ce0900 Net::SSH2::File::DESTROY Net::SSH2::SFTP::DESTROY Net::SSH2::SFTP::DESTROY freeing session libssh2_sftp_init(ss->session) -> 0x0 (FAIL) Net::SSH2::Channel::DESTROY Net::SSH2::DESTROY object 0x95c4390

The comments in parenthesis are mine, notice that the same object handle is returned with each successful call until it suddenly returns 0x0

Second attempt:
$ssh2->scp_get($old, $new)
Hangs silently after a few dozen, hundred or thousand iterations (the exact number varies greatly)

Net::SSH2::Channel::read(size = 8192, ext = 0) - read 8192 bytes - read 8192 total Net::SSH2::Channel::read(size = 8192, ext = 0) - read 4899 bytes - read 3293 bytes - read 8192 total Net::SSH2::Channel::read(size = 8192, ext = 0) - read 8192 bytes - read 8192 total Net::SSH2::Channel::read(size = 8192, ext = 0) - read 7228 bytes

...and it just sits there, waiting for the cows to come home.

Finally I try

my $chan = $ssh2->channel(); $chan->blocking(1); $chan->exec("cat myfile");

with results quite similar to sftp:

libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type +, window_size, packet_size, ((void *)0) , 0 ) -> 0x916e480 [53819:0]Net::SSH2::Channel::read(size = 1048576, ext = 0) - read 16384 bytes - read 16384 bytes - read 16384 bytes - read 4667 bytes - read -37 bytes - read 53819 total Net::SSH2::Channel::DESTROY libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type +, window_size, packet_size, ((void *)0) , 0 ) -> 0x0

Channel creation fails, three strikes and I'm out.

In reply to Net::SSH2 fails under heavy load by FloydATC

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.