Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sporadic Errno::ENOTTY #154

Open
luizkowalski opened this issue Jul 3, 2024 · 1 comment
Open

sporadic Errno::ENOTTY #154

luizkowalski opened this issue Jul 3, 2024 · 1 comment

Comments

@luizkowalski
Copy link

luizkowalski commented Jul 3, 2024

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.

@sshaw
Copy link

sshaw commented Sep 26, 2024

I have seen this before. It could be the server thinks it's an interactive connection, i.e. there's some real human luser doing the upload. Try setting :non_interactive => true.

If that doesn't work add the :logger => Logger.new($stdout), :verbose => :debug options (require "logger" first 😉) and see what extra info it gives you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants