Skip to content

sporadic Errno::ENOTTY  #154

@luizkowalski

Description

@luizkowalski

Hey 👋🏻

I'm debugging behavior on my app and can't tell exactly what's happening. I have a code like this:

def self.connect_to_dhl_de_tracking!
    credentials = {password: CREDENTIALS.dhl_de_sftp_tracking.password, port: CREDENTIALS.dhl_de_sftp_tracking.port}

    Net::SFTP.start(CREDENTIALS.dhl_de_sftp_tracking.host, CREDENTIALS.dhl_de_sftp_tracking.user, credentials) do |sftp|
      yield SFTP.new(sftp) # `SFTP` is a decorator we use to abstract `upload!` and log operations duration. Not really important
    end
  end

This code is executed asynchronously and every now and then, it triggers Errno::ENOTTY. When the job and rescued and re-executed, it works fine. The latest backtrace points even deeper than net-sftp:

lib/net/ssh/prompt.rb:44 noecho
lib/net/ssh/prompt.rb:44 ask
lib/net/ssh/authentication/methods/keyboard_interactive.rb:53 block (2 levels) in authenticate
<internal:numeric>:237:in `times'
lib/net/ssh/authentication/methods/keyboard_interactive.rb:50 block in authenticate
<internal:kernel>:187:in `loop'
lib/net/ssh/authentication/methods/keyboard_interactive.rb:19 authenticate
lib/net/ssh/authentication/session.rb:88 block in authenticate
lib/net/ssh/authentication/session.rb:72 each
lib/net/ssh/authentication/session.rb:72 authenticate

I can't understand if this is some misconfiguration on our end or a hiccup on the server we connect to. Some people said that using request_pty from session.open_channel would solve the problem but I doubt I should ditch Net::SFTP and do it all manually since it is a sporadic thing.

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