capistrano / sshkit

A toolkit for deploying code and assets to servers in a repeatable, testable, reliable way.
MIT License
1.14k stars 253 forks source link

NullPointerException while executing cap write_permissions task from tutorial #405

Closed batasrki closed 7 years ago

batasrki commented 7 years ago

Hey all,

I've added all the details to this SO post, https://stackoverflow.com/questions/44961954/nullpointerexception-while-executing-cap-write-permissions-task-from-tutorial.

Basically, I get a NullPointerException out of SSHKit while trying to execute any cap deploy task. Any help is much appreciated.

mattbrictson commented 7 years ago

Thanks for the report! It is entirely possible that there is JRuby-Specific bug. One thing that would help narrow it down is if you could take Capistrano out of the picture and create an SSHKit script that reproduces the problem. Could you try something like this?

#!/usr/bin/env ruby

require "sshkit"
include SSHKit::DSL

on "deployuser@demo.ourapp.com" do
  execute :date
end
batasrki commented 7 years ago

Hey @mattbrictson,

I'll do that this in about 5 hours and report back.

robd commented 7 years ago

Maybe this: https://github.com/jruby/jruby-openssl/issues/105

batasrki commented 7 years ago

@robd this is what I thought as well, then I executed the test outlined in that issue, and the test succeeded.

batasrki commented 7 years ago

Hey @mattbrictson, here's the script and output

$ bundle exec irb
jruby-9.1.12.0 :001 > require 'sshkit'
 => true
jruby-9.1.12.0 :002 > include SSHKit::DSL
 => Object
jruby-9.1.12.0 :003 > on "deployuser@demo.ourapp.com" do
jruby-9.1.12.0 :004 >     execute :date
jruby-9.1.12.0 :005?>   end
  INFO [f236774b] Running /usr/bin/env date as deployuser@demo.ourapp.com
SSHKit::Runner::ExecuteError: Exception while executing as deployuser@demo.ourapp.com:
    from /Users/srdjan/.bundle/jruby/2.3.0/gems/sshkit-1.14.0/lib/sshkit/runners/parallel.rb:15:in `block in execute'
robd commented 7 years ago

Hey @batasrki.

I should start by saying I've never used jruby and don't know anything about it, but I'm happy to try and help.

When you say 'executed the test outlined in that issue' do you mean that you tried this workaround? :

Net::SSH::Transport::Algorithms::ALGORITHMS.values.each { |algs| algs.reject! { |a| a =~ /^ecd(sa|h)-sha2/ } }
Net::SSH::KnownHosts::SUPPORTED_TYPE.reject! { |t| t =~ /^ecd(sa|h)-sha2/ }

Do you have a Gemfile? If so could you post your Gemfile and Gemfile.lock

batasrki commented 7 years ago

Hey @robd,

No worries, help is all welcome. What I meant was that the output of the command did not match the actual behaviour, but rather the expected behaviour. I didn't want to blindly run the workaround. Also, it's unclear to me if that is a one-time thing to execute or something that needs to be done every time.

batasrki commented 7 years ago

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    aasm (4.12.0)
      concurrent-ruby (~> 1.0)
    actionmailer (4.2.8)
      actionpack (= 4.2.8)
      actionview (= 4.2.8)
      activejob (= 4.2.8)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.8)
      actionview (= 4.2.8)
      activesupport (= 4.2.8)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.8)
      activesupport (= 4.2.8)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (4.2.8)
      activesupport (= 4.2.8)
      globalid (>= 0.3.0)
    activemodel (4.2.8)
      activesupport (= 4.2.8)
      builder (~> 3.1)
    activerecord (4.2.8)
      activemodel (= 4.2.8)
      activesupport (= 4.2.8)
      arel (~> 6.0)
    activerecord-jdbc-adapter (1.3.23)
      activerecord (>= 2.2, < 5.0)
    activerecord-jdbcmysql-adapter (1.3.23)
      activerecord-jdbc-adapter (~> 1.3.23)
      jdbc-mysql (>= 5.1.22)
    activerecord-jdbcpostgresql-adapter (1.3.23)
      activerecord-jdbc-adapter (~> 1.3.23)
      jdbc-postgres (>= 9.1)
    activesupport (4.2.8)
      i18n (~> 0.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    addressable (2.5.1)
      public_suffix (~> 2.0, >= 2.0.2)
    airbrussh (1.3.0)
      sshkit (>= 1.6.1, != 1.7.0)
    arel (6.0.4)
    audited (4.2.2)
      rails-observers (~> 0.1.2)
    audited-activerecord (4.2.2)
      activerecord (~> 4.0)
      audited (= 4.2.2)
    autoprefixer-rails (6.7.7.1)
      execjs
      json
    awesome_print (1.7.0)
    bcrypt (3.1.11-java)
    bootstrap-datepicker-rails (1.4.0)
      railties (>= 3.0)
    bootstrap-sass (3.3.7)
      autoprefixer-rails (>= 5.2.1)
      sass (>= 3.3.4)
    bootstrap3-datetimepicker-rails (4.17.47)
      momentjs-rails (>= 2.8.1)
    bugsnag (5.0.1)
    builder (3.2.3)
    bullet (5.5.1)
      activesupport (>= 3.0.0)
      uniform_notifier (~> 1.10.0)
    capistrano (3.8.2)
      airbrussh (>= 1.0.0)
      i18n
      rake (>= 10.0.0)
      sshkit (>= 1.9.0)
    capistrano-bundler (1.2.0)
      capistrano (~> 3.1)
      sshkit (~> 1.2)
    capistrano-multiconfig (3.1.0)
      capistrano (>= 3.7.0)
    capistrano-rails (1.3.0)
      capistrano (~> 3.1)
      capistrano-bundler (~> 1.1)
    capistrano-rvm (0.1.2)
      capistrano (~> 3.0)
      sshkit (~> 1.2)
    capistrano3-puma (3.1.1)
      capistrano (~> 3.7)
      capistrano-bundler
      puma (~> 3.4)
    circuit_breaker (1.1.2)
      aasm
    coderay (1.1.1)
    concurrent-ruby (1.0.5-java)
    cookiejar (0.3.3)
    database_cleaner (1.5.3)
    devise (3.5.10)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    diff-lcs (1.3)
    em-http-request (1.1.5)
      addressable (>= 2.3.4)
      cookiejar (!= 0.3.1)
      em-socksify (>= 0.3)
      eventmachine (>= 1.0.3)
      http_parser.rb (>= 0.6.0)
    em-socksify (0.3.1)
      eventmachine (>= 1.0.0.beta.4)
    erubis (2.7.0)
    eventmachine (1.2.3-java)
    excon (0.55.0)
    execjs (2.7.0)
    fancybox-rails (0.3.1)
      railties (>= 3.1.0)
    faye (1.2.4)
      cookiejar (>= 0.3.0)
      em-http-request (>= 0.3.0)
      eventmachine (>= 0.12.0)
      faye-websocket (>= 0.9.1)
      multi_json (>= 1.0.0)
      rack (>= 1.0.0)
      websocket-driver (>= 0.5.1)
    faye-websocket (0.10.7)
      eventmachine (>= 0.12.0)
      websocket-driver (>= 0.5.1)
    ffi (1.9.14-java)
    figaro (1.1.1)
      thor (~> 0.14)
    flying_saucer (0.8.0-java)
    font-awesome-rails (4.7.0.2)
      railties (>= 3.2, < 5.2)
    forgery (0.6.0)
    globalid (0.3.7)
      activesupport (>= 4.1.0)
    http_parser.rb (0.6.0-java)
    i18n (0.8.1)
    jdbc-mysql (5.1.42)
    jdbc-postgres (9.4.1206)
    jdbc-postgresql (9.2.1000)
    jquery-rails (4.0.5)
      rails-dom-testing (~> 1.0)
      railties (>= 4.2.0)
      thor (>= 0.14, < 2.0)
    jruby-jars (1.7.26)
    jruby-rack (1.1.20)
    json (1.8.6-java)
    jwt (1.5.6)
    loofah (2.0.3)
      nokogiri (>= 1.5.9)
    mail (2.6.4)
      mime-types (>= 1.16, < 4)
    mandrill-api (1.0.53)
      excon (>= 0.16.0, < 1.0)
      json (>= 1.7.7, < 2.0)
    method_source (0.8.2)
    mime-types (3.1)
      mime-types-data (~> 3.2015)
    mime-types-data (3.2016.0521)
    minitest (5.10.1)
    momentjs-rails (2.17.1)
      railties (>= 3.1)
    multi_json (1.12.1)
    net-ldap (0.16.0)
    net-scp (1.2.1)
      net-ssh (>= 2.6.5)
    net-ssh (4.1.0)
    nokogiri (1.7.1-java)
    orm_adapter (0.5.0)
    private_pub (1.0.3)
      faye
    pry (0.10.4-java)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
      spoon (~> 0.0)
    public_suffix (2.0.5)
    puma (3.8.2-java)
    rack (1.6.5)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.8)
      actionmailer (= 4.2.8)
      actionpack (= 4.2.8)
      actionview (= 4.2.8)
      activejob (= 4.2.8)
      activemodel (= 4.2.8)
      activerecord (= 4.2.8)
      activesupport (= 4.2.8)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.8)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.8)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-html-sanitizer (1.0.3)
      loofah (~> 2.0)
    rails-observers (0.1.2)
      activemodel (~> 4.0)
    rails4-autocomplete (1.1.1)
      rails (>= 3.0)
    railties (4.2.8)
      actionpack (= 4.2.8)
      activesupport (= 4.2.8)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.0.0)
    responders (2.3.0)
      railties (>= 4.2.0, < 5.1)
    rspec-core (3.5.4)
      rspec-support (~> 3.5.0)
    rspec-expectations (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-mocks (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-rails (3.5.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
      rspec-support (~> 3.5.0)
    rspec-support (3.5.0)
    rubyzip (1.2.1)
    sass (3.4.23)
    sass-rails (5.0.6)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    slop (3.6.0)
    spoon (0.0.6)
      ffi
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.0)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    sshkit (1.14.0)
      net-scp (>= 1.1.2)
      net-ssh (>= 2.8.0)
    therubyrhino (2.0.4)
      therubyrhino_jar (>= 1.7.3)
    therubyrhino_jar (1.7.6)
    thor (0.19.4)
    thread_safe (0.3.6-java)
    tilt (2.0.7)
    timecop (0.8.1)
    twilio-ruby (4.13.0)
      builder (>= 2.1.2)
      jwt (~> 1.0)
      multi_json (>= 1.3.0)
    tzinfo (1.2.3)
      thread_safe (~> 0.1)
    tzinfo-data (1.2017.2)
      tzinfo (>= 1.0.0)
    uglifier (3.1.13)
      execjs (>= 0.3.0, < 3)
    uniform_notifier (1.10.0)
    warbler (1.4.10)
      jruby-jars (>= 1.5.6, < 2.0)
      jruby-rack (>= 1.1.1, < 1.3)
      rake (>= 0.9.6)
      rubyzip (>= 0.9, < 1.3)
    warden (1.2.7)
      rack (>= 1.0)
    websocket-driver (0.6.5-java)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.2)
    yaml_db (0.6.0)
      rails (>= 3.0, < 5.2)
      rake (>= 0.8.7)

PLATFORMS
  java

DEPENDENCIES
  activerecord-jdbcmysql-adapter
  activerecord-jdbcpostgresql-adapter
  audited-activerecord (~> 4.0)
  awesome_print
  bootstrap-datepicker-rails (~> 1.4.0)
  bootstrap-sass (~> 3.3)
  bootstrap3-datetimepicker-rails (~> 4.17.47)
  bugsnag
  bullet
  capistrano-bundler
  capistrano-multiconfig
  capistrano-rails (~> 1.1)
  capistrano-rvm
  capistrano3-puma
  circuit_breaker
  database_cleaner
  devise (~> 3.2)
  fancybox-rails
  figaro
  flying_saucer
  font-awesome-rails
  forgery
  guard-rspec
  jdbc-mysql
  jdbc-postgresql
  jquery-rails (~> 4.0.3)
  json
  mandrill-api
  momentjs-rails (>= 2.9.0)
  mysql2
  net-ldap
  private_pub
  pry
  puma
  rails (~> 4.2.7)
  rails4-autocomplete
  rspec-rails
  sass-rails (~> 5.0.3)
  therubyrhino
  timecop
  twilio-ruby
  tzinfo
  tzinfo-data
  uglifier (>= 1.0.3)
  warbler (~> 1.4.8)
  yaml_db

BUNDLED WITH
   1.15.1
robd commented 7 years ago

Thanks for the info about the test, and for the Gemfile. Could you post the output of the commands in that test here:

irb(main):001:0> require 'net/ssh'
irb(main):002:0> Gem.loaded_specs['net-ssh'].version
irb(main):003:0> RUBY_DESCRIPTION
irb(main):004:0> Net::SSH.start("some-server.example.com", "some_username")

Also, if possible do you know if you have the jruby-openssl gem installed, and if so what version? I guess you do, but it isn't in your Gemfile but is in your system. If you don't mind could you see if it's listed by calling gem list from the command line?

Another way might be to evaluate Jopenssl::VERSION from the rails console.

Mainly just wondering if you have the latest version v0.9.20 of jruby-openssl which includes this commit: https://github.com/jruby/jruby-openssl/commit/47c9f427784d3e0dca66cdbdce144b8c58955ae8

batasrki commented 7 years ago

Here we go.

jruby-9.1.12.0 :009 > Jopenssl::VERSION
 => "0.9.20"

jruby-9.1.12.0 :013 > Gem.loaded_specs['net-ssh'].version
 => #<Gem::Version "4.1.0">
jruby-9.1.12.0 :014 > RUBY_DESCRIPTION
 => "jruby 9.1.12.0 (2.3.3) 2017-06-15 33c6439 Java HotSpot(TM) 64-Bit Server VM 25.73-b02 on 1.8.0_73-b02 +jit [darwin-x86_64]"
jruby-9.1.12.0 :015 > Net::SSH.start("some-server.example.com", "some_username")
SocketError: getaddrinfo: name or service not known
    from org/jruby/ext/socket/Addrinfo.java:305:in `getaddrinfo'
    from /Users/srdjan/.rvm/rubies/jruby-9.1.12.0/lib/ruby/stdlib/socket.rb:231:in `foreach'
    from /Users/srdjan/.rvm/rubies/jruby-9.1.12.0/lib/ruby/stdlib/socket.rb:327:in `tcp'
    from /Users/srdjan/.bundle/jruby/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh/transport/session.rb:71:in `initialize'
    from /Users/srdjan/.bundle/jruby/2.3.0/gems/net-ssh-4.1.0/lib/net/ssh.rb:233:in `start'
    from (irb):15:in `<eval>'
    from org/jruby/RubyKernel.java:1000:in `eval'
    from org/jruby/RubyKernel.java:1298:in `loop'
    from org/jruby/RubyKernel.java:1120:in `catch'
    from org/jruby/RubyKernel.java:1120:in `catch'
    from /Users/srdjan/.rvm/rubies/jruby-9.1.12.0/bin/irb:13:in `<main>'
    from org/jruby/RubyKernel.java:979:in `load'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/cli/exec.rb:1:in `(root)'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/cli/exec.rb:74:in `kernel_load'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/cli/exec.rb:27:in `run'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/cli.rb:360:in `exec'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/cli.rb:20:in `dispatch'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/cli.rb:10:in `block in start'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/exe/bundle:35:in `(root)'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/lib/bundler/friendly_errors.rb:121:in `<main>'
    from org/jruby/RubyKernel.java:979:in `load'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/gems/bundler-1.15.1/exe/bundle:27:in `<eval>'
    from org/jruby/RubyKernel.java:1000:in `eval'
    from /Users/srdjan/.rvm/gems/jruby-9.1.12.0/bin/jruby_executable_hooks:15:in `<main>'
robd commented 7 years ago

Great thanks. One final thing. Could you try replacing the server in the test (some-server.example.com) with your server and username. Many thanks.

batasrki commented 7 years ago
jruby-9.1.12.0 :016 > Net::SSH.start("demo.ourapp.com", "deployuser")
 => #<Net::SSH::Connection::Session:0x17ec5e2a @max_win_size=131072, @max_pkt_size=32768, @keepalive=#<Net::SSH::Connection::Keepalive:0x52290e63 @unresponded_keepalive_count=0, @last_keepalive_sent_at=nil, @session=#<Net::SSH::Connection::Session:0x17ec5e2a ...>, @logger=#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>>, @listeners={#<Socket:fd 24>=>nil}, @properties={}, @options={:auth_methods=>["none", "publickey", "password", "keyboard-interactive"], :logger=>#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, :password_prompt=>#<Net::SSH::Prompt:0x62359532>, :user=>"deployuser"}, @channels={}, @on_global_request={}, @channel_open_handlers={}, @channel_id_counter=-1, @logger=#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, @transport=#<Net::SSH::Transport::Session:0x11978f52 @socket=#<Socket:fd 24>, @host_as_string="demo.ourapp.com,209.15.211.114", @options={:auth_methods=>["none", "publickey", "password", "keyboard-interactive"], :logger=>#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, :password_prompt=>#<Net::SSH::Prompt:0x62359532>, :user=>"deployuser"}, @host_key_verifier=#<Net::SSH::Verifiers::Lenient:0x3e0855b0>, @bind_address=nil, @queue=[], @algorithms=#<Net::SSH::Transport::Algorithms:0x484b5a21 @kex="diffie-hellman-group-exchange-sha1", @language_client="", @initialized=true, @client_packet="\x14\x810m\x18\xF6J\xE2\x93\xE7\xE2\xB5\x8C\x87\xBATS\x00\x00\x00\xB7diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521\x00\x00\x00\x85ssh-rsa,ssh-dss,ssh-rsa-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521\x00\x00\x00\xCDaes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc,none,arcfour128,arcfour256,arcfour,aes128-ctr,aes192-ctr,aes256-ctr,cast128-ctr,blowfish-ctr,3des-ctr\x00\x00\x00\xCDaes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,idea-cbc,none,arcfour128,arcfour256,arcfour,aes128-ctr,aes192-ctr,aes256-ctr,cast128-ctr,blowfish-ctr,3des-ctr\x00\x00\x00\x98hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-96,hmac-sha2-512-96,none\x00\x00\x00\x98hmac-sha1,hmac-md5,hmac-sha1-96,hmac-md5-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha2-256-96,hmac-sha2-512-96,none\x00\x00\x00\x1Anone,zlib@openssh.com,zlib\x00\x00\x00\x1Anone,zlib@openssh.com,zlib\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", @language_server="", @server_data={:raw=>"\x14{\xEC\xE1\xF5\x88\xA7x\x1C\e\xAD\x8F\xCC\xE2\x91\x81%\x00\x00\x00~diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\x00\x00\x00\x0Fssh-rsa,ssh-dss\x00\x00\x00\x9Daes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se\x00\x00\x00\x9Daes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se\x00\x00\x00\x85hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96\x00\x00\x00\x85hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96\x00\x00\x00\x15none,zlib@openssh.com\x00\x00\x00\x15none,zlib@openssh.com\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", :kex=>["diffie-hellman-group-exchange-sha256", "diffie-hellman-group-exchange-sha1", "diffie-hellman-group14-sha1", "diffie-hellman-group1-sha1"], :host_key=>["ssh-rsa", "ssh-dss"], :encryption_client=>["aes128-ctr", "aes192-ctr", "aes256-ctr", "arcfour256", "arcfour128", "aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "arcfour", "rijndael-cbc@lysator.liu.se"], :encryption_server=>["aes128-ctr", "aes192-ctr", "aes256-ctr", "arcfour256", "arcfour128", "aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "arcfour", "rijndael-cbc@lysator.liu.se"], :hmac_client=>["hmac-md5", "hmac-sha1", "umac-64@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-ripemd160", "hmac-ripemd160@openssh.com", "hmac-sha1-96", "hmac-md5-96"], :hmac_server=>["hmac-md5", "hmac-sha1", "umac-64@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-ripemd160", "hmac-ripemd160@openssh.com", "hmac-sha1-96", "hmac-md5-96"], :compression_client=>["none", "zlib@openssh.com"], :compression_server=>["none", "zlib@openssh.com"], :language_client=>[], :language_server=>[]}, @pending=false, @session=#<Net::SSH::Transport::Session:0x11978f52 ...>, @options={:auth_methods=>["none", "publickey", "password", "keyboard-interactive"], :logger=>#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, :password_prompt=>#<Net::SSH::Prompt:0x62359532>, :user=>"deployuser"}, @hmac_server="hmac-sha1", @encryption_server="aes128-cbc", @server_packet="\x14{\xEC\xE1\xF5\x88\xA7x\x1C\e\xAD\x8F\xCC\xE2\x91\x81%\x00\x00\x00~diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1\x00\x00\x00\x0Fssh-rsa,ssh-dss\x00\x00\x00\x9Daes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se\x00\x00\x00\x9Daes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se\x00\x00\x00\x85hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96\x00\x00\x00\x85hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96\x00\x00\x00\x15none,zlib@openssh.com\x00\x00\x00\x15none,zlib@openssh.com\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", @logger=#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, @algorithms={:host_key=>["ssh-rsa", "ssh-dss", "ssh-rsa-cert-v01@openssh.com", "ssh-rsa-cert-v00@openssh.com", "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384", "ecdsa-sha2-nistp521"], :kex=>["diffie-hellman-group-exchange-sha1", "diffie-hellman-group1-sha1", "diffie-hellman-group14-sha1", "diffie-hellman-group-exchange-sha256", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521"], :encryption=>["aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "rijndael-cbc@lysator.liu.se", "idea-cbc", "none", "arcfour128", "arcfour256", "arcfour", "aes128-ctr", "aes192-ctr", "aes256-ctr", "cast128-ctr", "blowfish-ctr", "3des-ctr"], :hmac=>["hmac-sha1", "hmac-md5", "hmac-sha1-96", "hmac-md5-96", "hmac-ripemd160", "hmac-ripemd160@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha2-256-96", "hmac-sha2-512-96", "none"], :compression=>["none", "zlib@openssh.com", "zlib"], :language=>[], :encryption_server=>["aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "rijndael-cbc@lysator.liu.se", "idea-cbc", "none", "arcfour128", "arcfour256", "arcfour", "aes128-ctr", "aes192-ctr", "aes256-ctr", "cast128-ctr", "blowfish-ctr", "3des-ctr"], :encryption_client=>["aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "rijndael-cbc@lysator.liu.se", "idea-cbc", "none", "arcfour128", "arcfour256", "arcfour", "aes128-ctr", "aes192-ctr", "aes256-ctr", "cast128-ctr", "blowfish-ctr", "3des-ctr"], :hmac_server=>["hmac-sha1", "hmac-md5", "hmac-sha1-96", "hmac-md5-96", "hmac-ripemd160", "hmac-ripemd160@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha2-256-96", "hmac-sha2-512-96", "none"], :hmac_client=>["hmac-sha1", "hmac-md5", "hmac-sha1-96", "hmac-md5-96", "hmac-ripemd160", "hmac-ripemd160@openssh.com", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha2-256-96", "hmac-sha2-512-96", "none"], :compression_server=>["none", "zlib@openssh.com", "zlib"], :compression_client=>["none", "zlib@openssh.com", "zlib"], :language_server=>[], :language_client=>[]}, @compression_client="none", @encryption_client="aes128-cbc", @host_key="ssh-rsa", @compression_server="none", @session_id="\xCB}:\\{\xC9\x81\xD43\xF8\x90\xA4\rFh\xB4\r\xDD\x00]", @hmac_client="hmac-sha1">, @logger=#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, @server_version=#<Net::SSH::Transport::ServerVersion:0x58a8ea6f @version="SSH-2.0-OpenSSH_5.3", @logger=#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, @header="">, @port=22, @host_keys=#<Net::SSH::HostKeys:0x2e6b379c @known_hosts=Net::SSH::KnownHosts, @host_keys=[#<OpenSSL::PKey::RSA:0x1ff81b0d @blob="\x00\x00\x00\assh-rsa\x00\x00\x00\x01#\x00\x00\x01\x01\x00\xDA\xC5\x19\x1C\x90\xD1R\x87\xFBI\x18\x9A\xD6\xBE\xAA\xE7\t\x89Q\xEE[8\n7\x9F\x11\xE7\xB8\xD8fp\xB8\x00\xB7\xD1\x019\xCCu\xF1*j\xCA\x1F\"\xFE\xAD\xCCO$Z\xC6Mc\x80\xF09\xBC%\xFFr\x9F\n\xEA/]\xF2~\xC0\xA3\xD5\xC1\xA5\xCF\x1Dl_x\xD8\x00&l\xB5\a\xFBC8t\xA8L\x84Y&\x90\xF3\f/\rb;\xD5\xA1R?hB\xE1$\x90\xBBg\xB8\x8B\x8A\xB2\xB1\xA0\xD4\xFAr\x17\xFD\x14S\xC3#\xF1^}\xB3\xE6FGvy\xB1\x1DF\x858>^t\n\xA3\x0F\x8EG\xC4\xC8\xAB\x9A\xF3\xAE\xAE\xD9<\xE5\xE8\x11D\x9C\x93\x1Fs\xE2o\xF0\xAB\xB7\xDDF\x1F@\x00yQ\x12O\xD4\x867&9N\xFB\x9C%\xA5\xBC\xAE\xBDRNd\x86\xB8\x8Fg\xFF\xC2\xDE\xD6\xF1\xE4\xF4\x10\f\xDD4\xB6\x99\xE5\x95.\x84\xC8\x1DLl\e\x16\x9A\xC8\xA6\xAF\xE4\xBAL\x93\b\xB0K]\xE8\xF4\xB7\xDCnr\xA2\x83\xAC\x82MM\xB5\xC7\xD6C\xFB\xA6\xD0\xF6$\xE1">], @host="demo.ourapp.com,209.15.211.114", @options={:auth_methods=>["none", "publickey", "password", "keyboard-interactive"], :logger=>#<Logger:0x233f52f8 @default_formatter=#<Logger::Formatter:0x6c2dd88b @datetime_format=nil>, @level=4, @progname=nil, @formatter=nil, @logdev=#<Logger::LogDevice:0x49d979c4 @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mon_mutex=#<Mutex:0x3cb173db>, @shift_size=nil, @mon_count=0, @mon_owner=nil>>, :password_prompt=>#<Net::SSH::Prompt:0x62359532>, :user=>"deployuser"}>, @host="demo.ourapp.com">, @pending_requests=[], @event_loop=#<Net::SSH::Connection::SingleSessionEventLoop:0x1c610f @sessions=[#<Net::SSH::Connection::Session:0x17ec5e2a ...>], @logger=nil>>
robd commented 7 years ago

Hi @batasrki, thanks a lot for the further debug info. I'm sort of out of ideas about this - from the investigations you've done it does seem to be something Capistrano / SSHKit specific.

One thing I noticed is that the exception you see looks like it might be from the same point in the code in PKeyEC.java as that issue. It's Line 836 in the issue, and line 845 in your exception - ECPointUtil.decodePoint(group.getCurve(), encoded). So my hunch is still that the workaround I mentioned before might work.

If you did want to try it, I'm not exactly sure at what point you would need to apply that workaround - it might be worth enquiring on that thread. From my limited understanding, It looks like it is just telling the client not to try any elliptic curve algorithms when connecting because they don't work yet. I would start by trying this at the top of your Capfile. I think the fix would apply for anything that used Net::SSH after you call the fix up until that jruby process (or thread?) exited.

Hope this helps.

batasrki commented 7 years ago

Hey @robd, so shoving those 2 lines at the top of the Capfile has indeed fixed my problem.

Thanks so much for your help!