Errno::ECONNREFUSED: Connection refused - connect(2) after any task

185 views
Skip to first unread message

Piotr Kaczorek

unread,
Jun 24, 2014, 3:18:34 PM6/24/14
to capis...@googlegroups.com
I have a problem with every task I'm trying to run...
I've defined simple 'whoami' task to test a case as simple as possible.
task :whoami do
  on roles
(:all) do
    execute
:whoami
    execute
'pwd'
 
end
end

Looks like the task runs successfully (see below) but after the task finishes Capistrano returns connection refused error.
I'm using a key to log in to the server (anyway it seems to be working... except the final error).

Versions:
  • Ruby 2.0.0
  • Capistrano Version: 3.1.0
  • Rake / Rails / etc Rake Version: 10.2.2, Rails Version 4.0.2
Platform:
  • Working on.... Arch
  • Deploying to... Debian
Logs:

cap devel whoami --trace
** Invoke devel (first_time)
** Execute devel
** Invoke load:defaults (first_time)
** Execute load:defaults
** Invoke bundler:map_bins (first_time)
** Execute bundler:map_bins
** Invoke whoami (first_time)
** Execute whoami
 INFO
[e2f8fba2] Running /usr/bin/env whoami on IP_ADDR
DEBUG
[e2f8fba2] Command: /usr/bin/env whoami
 INFO
[43645238] Running /usr/bin/env whoami on
DEBUG
[43645238] Command: /usr/bin/env whoami
DEBUG
[e2f8fba2]        app
 INFO
[e2f8fba2] Finished in 0.523 seconds with exit status 0 (successful).
 INFO
[8a61d73d] Running /usr/bin/env pwd on IP_ADDR
DEBUG
[8a61d73d] Command: /usr/bin/env pwd
DEBUG
[8a61d73d]        /home/app
 INFO
[8a61d73d] Finished in 0.072 seconds with exit status 0 (successful).
cap aborted
!
Errno::ECONNREFUSED: Connection refused - connect(2)
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `initialize'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `
open'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `block in initialize'

/home/kaczor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
/home/kaczor/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/timeout.rb:97:in `
timeout'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:67:in `initialize'

/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `new'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh.rb:200:in `
start'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/connection_pool.rb:25:in `create_or_reuse_connection'

/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:173:in `ssh'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:126:in `
block in _execute'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `tap'

/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:123:in `_execute'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:66:in `
execute'
config/deploy.rb:82:in `block (2 levels) in <top (required)>'

/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `instance_exec'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/backends/netssh.rb:54:in `
run'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/sshkit-1.3.0/lib/sshkit/runners/parallel.rb:12:in `block (2 levels) in execute'

Tasks: TOP => whoami


When I enabled the ssh debugging I get something like that at the end:

...
DEBUG
[15729cf0]        /home/app
D
, [2014-06-24T20:51:33.473864 #26658] DEBUG -- tcpsocket[c11984]: received packet nr 20 type 96 len 12
I
, [2014-06-24T20:51:33.473914 #26658]  INFO -- net.ssh.connection.session[d55b74]: channel_eof: 1
D
, [2014-06-24T20:51:33.473983 #26658] DEBUG -- tcpsocket[c11984]: received packet nr 21 type 98 len 44
I
, [2014-06-24T20:51:33.474035 #26658]  INFO -- net.ssh.connection.session[d55b74]: channel_request: 1 exit-status false
 INFO
[15729cf0] Finished in 0.081 seconds with exit status 0 (successful).
D
, [2014-06-24T20:51:33.474175 #26658] DEBUG -- tcpsocket[c11984]: received packet nr 22 type 97 len 12
I
, [2014-06-24T20:51:33.474216 #26658]  INFO -- net.ssh.connection.session[d55b74]: channel_close: 1
D
, [2014-06-24T20:51:33.474300 #26658] DEBUG -- tcpsocket[c11984]: queueing packet nr 14 type 97 len 28
cap aborted
!
Errno::ECONNREFUSED: Connection refused - connect(2)
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `initialize'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `
open'
/home/kaczor/.rvm/gems/ruby-2.0.0-p353/gems/net-ssh-2.8.0/lib/net/ssh/transport/session.rb:70:in `block in initialize'

...

Any ideas ? What else should I try ?

Regards,
Piotr

Lee Hambley

unread,
Jun 24, 2014, 4:24:52 PM6/24/14
to capistrano
Limited number of connections on the server, maybe ? What is your sshkit gem version?

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/f56edfb9-17dc-4ec0-b8b9-6dda141ce15d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Piotr Kaczorek

unread,
Jun 25, 2014, 3:31:02 AM6/25/14
to capis...@googlegroups.com
sshkit version is 1.3.0

Limited number of connections ? I think I'm the only person using ssh on the server at the moment, the setup is 'default' (how can I check if it's this?).
Reply all
Reply to author
Forward
0 new messages