gpt4 book ai didi

ruby-on-rails - 卡皮斯特拉诺 : NoMethodError: undefined method `recv' for #

转载 作者:行者123 更新时间:2023-12-03 22:41:18 24 4
gpt4 key购买 nike

Capistrano 中的这个错误 (> 3) 阻止我部署我的 Rails 应用程序。我的 Capistrano 配置在另一个环境中运行良好。

DEBUG [6c7d7bed] Command: if test ! -d /opt/my_app/releases/20140429175529; then echo "Directory does not exist '/opt/my_app/releases/20140429175529'" 1>&2; false; fi
cap aborted!
NoMethodError: undefined method `recv' for #<IO:fd 49>
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/buffered_io.rb:65:in `fill'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/packet_stream.rb:86:in `next_packet'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:178:in `block in poll_message'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:173:in `loop'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:173:in `poll_message'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:210:in `block in wait'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:208:in `loop'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:208:in `wait'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:87:in `initialize'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `new'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `start'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/connection_pool.rb:24:in `create_or_reuse_connection'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:126:in `block in _execute'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/abstract.rb:75:in `within'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/capistrano-3.2.1/lib/capistrano/tasks/deploy.rake:207:in `block (3 levels) in <top (required)>'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/such/.rvm/gems/ruby-2.1.1@my_app/gems/sshkit-1.4.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'
Tasks: TOP => deploy:set_current_revision
(See full trace by running task with --trace)
The deploy has failed with an error: #<NoMethodError: undefined method `recv' for #<IO:fd 49>>

我正在使用代理连接到我的远程服务器(在两个环境中)。 SSH 连接工作正常。

set :ssh_options, proxy: Net::SSH::Proxy::Command.new('ssh user@gateway -W %h:%p')

有没有人遇到过这个问题?

解决方法

我对错误的理解很薄弱,就是在ssh协商后,有时返回给net-ssh的socket是一个文件描述符,这是意想不到的。我已经添加:

gem 'sshkit', github: 'msimonin/sshkit', branch: 'gateway'

到我的 Gemfile 以便 ssh 连接只建立一次。

相关配置为:

SSHKit.config.backend.configure do |ssh|
ssh.gateway = 'user@gateway'
end

这种方式效果很好。我等不及要合并拉取请求了。

最佳答案

如果您使用代理命令,连接对象始终是文件描述符支持的 IO 实例。该代码位于 lib/net/ssh/proxy/command.rb 中,它在弹出管道的位之后立即注入(inject) recv 方法并等待某些内容变得可读,所以我不确定为什么它有时会失败(我'我也看过)。根据调用堆栈,我认为它已经返回,所以 recv 应该在那里。

你有没有打开一个问题?

关于ruby-on-rails - 卡皮斯特拉诺 : NoMethodError: undefined method `recv' for #<IO:fd XX>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23372076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com