Capistrano Hangs on Mac OS X Leopard

05
Apr

I use Capistrano to deploy my webapps and have been for a while. I also deploy right from my laptop quite frequently. So I was a little taken aback when I could deploy in one place and not in another. It turned out that Capistrano was having issues with deploying to multiple servers. In fact, it turned out that the problem had the appearance of being Capistrano, but in actuality, it was Net-SSH. The whole issue can be tracked via the Lighthouse ticket here. I’m going to show you how to diagnose if you have this problem faster and how to fix it.

However, the shorter version is as follows. It starts out by hanging while trying to parallelize multiple connections. Not only does it hang, but it should peg your CPU. You will be able to tell this if you hit the Terminal and type uptime and you see a high load average and it keeps climbing while your deploy is hung.

1
2
3
4
5
6
7
8
9
elubow@beacon capistrano$ uptime && sleep 5 && uptime
22:25  up 7:25 mins, 2 users, load averages: 2.58 0.61 0.47
22:25  up 7:25 mins, 2 users, load averages: 3.16 1.11 0.97
elubow@beacon capistrano$ ruby -v
ruby 1.8.6 (2009-03-31 patchlevel 368) [i686-darwin9.7.0]
elubow@beacon capistrano$ cap deploy:mail:modules
  * executing `deploy:mail:modules'
  * executing "sudo mkdir -p /usr/local/lib/perl5/STMail && sudo chmod g+w /usr/local/lib/perl5/STMail"
    servers: ["10.123.125.82", "10.123.125.101", "10.123.125.107", "10.123.125.113"]

I am able to replicate the problem all the way back to Net-SSH 2.0.11 (although it may go back further). All you have to do is upgrade your version of Net-SSH. Check your version and then upgrade if necessary.

1
2
3
4
5
6
7
elubow@beacon capistrano$ gem list | grep ssh
net-ssh (2.0.21, 2.0.11)
elubow@beacon capistrano$ sudo gem install net-ssh
Successfully installed net-ssh-2.0.21
1 gem installed
Installing ri documentation for net-ssh-2.0.21...
Installing RDoc documentation for net-ssh-2.0.21...

Hope this helps.

4 Responses to “Capistrano Hangs on Mac OS X Leopard”

  1. Thanks for posting this tip! Been banging my head for 2 days wondering what was wrong with my ssh config.

  2. Thanks for the tip, you saved me a lot of grief.

  3. Nimander says:

    Very nice! This solved our mysterious can’t-deploy-from-MacbookPro problem.

Leave a Reply