net-ssh / net-scp

Pure Ruby implementation of the SCP protocol
http://github.com/delano/net-scp
MIT License
154 stars 63 forks source link

Broken Pipe on files larger than 4GB #39

Closed mrmarbury closed 6 years ago

mrmarbury commented 6 years ago

I have the following problem:

I try to dowload large files (20GB, 200GB) with net-scp and exactly after 4GB I get this error:

/home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/buffered_io.rb:102:in `send': Broken pipe - send(2) (Errno::EPIPE)
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/buffered_io.rb:102:in `send_pending'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:280:in `block in ev_do_handle_events'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:279:in `each'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:279:in `ev_do_handle_events'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/event_loop.rb:110:in `ev_select_and_postprocess'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/event_loop.rb:29:in `process'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:225:in `process'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:178:in `block in loop'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:178:in `loop'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:178:in `loop'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-ssh-4.2.0/lib/net/ssh/connection/session.rb:124:in `close'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-scp-1.2.1/lib/net/scp.rb:210:in `ensure in start'
    from /home/marbury/.rvm/gems/ruby-2.4.3@ovirt-migration/gems/net-scp-1.2.1/lib/net/scp.rb:210:in `start'
    from /home/marbury/Projects/Work/TNG/ovirt-migration/bin/migration:89:in `run'
    from /home/marbury/Projects/Work/TNG/ovirt-migration/bin/migration:151:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

I can scp the file through the OpenSSH scp command just fine. So ulimit, file-system(128bit), quotas, server/client-config, and the like are not the issue. My OS and Ruby are 64bit as well (checked ruby with the unix file command).

Are there any limitations in this implementation that I don't know about? Is there a flag that can be set?

Thanks for your help, Stefan

mfazekas commented 6 years ago

More info:

started sshd with debug logs, i see the following on server side:

channel 0: adjust 131072 overflows remote window 4294852543

Seems to be from: update_local_window_size

sudo /usr/sbin/sshd -D -E /var/log/sshd.log -p 2222

$:.push('./lib')
$:.push('../net-ssh/lib')

require 'net/scp'
require 'byebug'

path = "/path/to/bigfile.txt"
Net::SCP.download!("localhost", ENV["USER"],
  path, "/tmp/bigfix.tmp", ssh: { verbose: :debug, port: 2222 })
mfazekas commented 6 years ago

Should be fixed with https://rubygems.org/gems/net-ssh/versions/5.0.0.rc1 pls test