Capistrano(> 3)中的這個錯誤阻止了我部署Rails應用程序。我的Capistrano配置在另一個環境中工作正常。Capistrano:NoMethodError:undefined方法`recv'for#<IO:fd XX>
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/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/buffered_io.rb:65:in `fill'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/packet_stream.rb:86:in `next_packet'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:178:in `block in poll_message'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:173:in `loop'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:173:in `poll_message'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:210:in `block in wait'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:208:in `loop'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:208:in `wait'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:87:in `initialize'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `new'
/Users/such/.rvm/gems/[email protected]_app/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `start'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/connection_pool.rb:24:in `create_or_reuse_connection'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:126:in `block in _execute'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `tap'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:66:in `execute'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/abstract.rb:75:in `within'
/Users/such/.rvm/gems/[email protected]_app/gems/capistrano-3.2.1/lib/capistrano/tasks/deploy.rake:207:in `block (3 levels) in <top (required)>'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/Users/such/.rvm/gems/[email protected]_app/gems/sshkit-1.4.0/lib/sshkit/backends/netssh.rb:54:in `run'
/Users/such/.rvm/gems/[email protected]_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 [email protected] -W %h:%p')
有沒有人遇到過這個問題?
解決方法
我的錯誤弱的理解是,SSH協商後,有時插座回到淨SSH是一個文件描述符這是意想不到的。 我已經加入:
gem 'sshkit', github: 'msimonin/sshkit', branch: 'gateway'
我的Gemfile使得ssh連接成立僅一次。
相關的配置是:
SSHKit.config.backend.configure do |ssh|
ssh.gateway = '[email protected]'
end
它正常工作,這種方式。我不能等待拉取請求被合併。
什麼是在另一個環境中的紅寶石和鋼軌版本,你是否使用類似的版本的Capistrano? –
我使用的是完全相同的版本:Rails 4.1.0,ruby 2.1.1,Capistrano 3.2.1(不能與3.2.0一起工作) – Such
看起來像一堆其他人都有這個問題https:/ /github.com/capistrano/sshkit/issues/150 –