Skip to content

Frequent error : Broken pipe @ rb_io_flush_raw - <STDOUT> on production server #158

@sriranggd

Description

@sriranggd

Hi,

I am using net-sftp to upload a file and I am getting this error quite frequently on my production server. The code using net-sftp is being run through an ActiveJob worker.

OS : Ubuntu 24.04.1 LTS
Ruby : ruby 3.3.1 (2024-04-23 revision c56cd86388) [aarch64-linux]
net-sftp : 4.0.0

This is how I am using net-sftp

          options = {password: sftp_config[:password], port: sftp_config[:port], logger: Rails.logger}
          Net::SFTP.start(sftp_config[:host], sftp_config[:username], options) do |sftp|
            remote_path = File.join(sftp_config[:remote_directory], filename)
            sftp.file.open(remote_path, 'w') do |f|
              f.write(json_content)
            end
          end

Here is the stack :

/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh/prompt.rb:43:in `flush'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh/prompt.rb:43:in `ask'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh/authentication/methods/password.rb:68:in `ask_password'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh/authentication/methods/password.rb:20:in `authenticate'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh/authentication/session.rb:88:in `block in authenticate'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh/authentication/session.rb:72:in `each'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh/authentication/session.rb:72:in `authenticate'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-ssh-7.3.0/lib/net/ssh.rb:262:in `start'
/var/www/my_app/vendor/bundle/ruby/3.3.0/gems/net-sftp-4.0.0/lib/net/sftp.rb:36:in `start'

How can I go about solving this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions