I’m trying to setup Unicorn with Nginx on my Ubuntu 11.04 machine. I compiled Ruby from the source, (previously tried RVM but had numerous problems with that) and now after installing unicorn (as well as rails 3.1.0 RC4) it has a strange issue where it crashes and then tries to run the part that’s crashing repeatedly, or at least that’s what it looks like.
Output
root@server-pc:/usr/local/blog# unicorn_rails
I, [2011-07-15T13:14:50.577149 #23269] INFO -- : listening on addr=0.0.0.0:8080 fd=3
I, [2011-07-15T13:14:50.577677 #23269] INFO -- : worker=0 spawning...
I, [2011-07-15T13:14:50.579412 #23269] INFO -- : master process ready
I, [2011-07-15T13:14:50.581087 #23271] INFO -- : worker=0 spawned pid=23271
I, [2011-07-15T13:14:50.581599 #23271] INFO -- : Refreshing Gem list
/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.3.1, but your Gemfile requires rack 1.3.0. Consider using bundle exec. (Gem::LoadError)
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `block in each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:17:in `setup'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler.rb:107:in `setup'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/setup.rb:7:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/blog/config/boot.rb:6:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/blog/config/application.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/blog/config/environment.rb:2:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from config.ru:4:in `block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn.rb:44:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn.rb:44:in `block in builder'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn_rails:139:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn_rails:139:in `block in rails_builder'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:673:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:673:in `build_app!'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:549:in `init_worker_process'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:567:in `worker_loop'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:475:in `spawn_missing_workers'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:135:in `start'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn_rails:209:in `<top (required)>'
from /usr/local/bin/unicorn_rails:19:in `load'
from /usr/local/bin/unicorn_rails:19:in `<main>'
E, [2011-07-15T13:14:52.259536 #23269] ERROR -- : reaped #<Process::Status: pid 23271 exit 1> worker=0
I, [2011-07-15T13:14:52.259859 #23269] INFO -- : worker=0 spawning...
I, [2011-07-15T13:14:52.263092 #23274] INFO -- : worker=0 spawned pid=23274
I, [2011-07-15T13:14:52.263665 #23274] INFO -- : Refreshing Gem list
^C/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.3.1, but your Gemfile requires rack 1.3.0. Consider using bundle exec. (Gem::LoadError)
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `block in each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:17:in `setup'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler.rb:107:in `setup'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/setup.rb:7:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:33:in `require'
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/blog/config/boot.rb:6:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/blog/config/application.rb:1:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from /usr/local/blog/config/environment.rb:2:in `<top (required)>'
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from config.ru:4:in `block in <main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/rack-1.3.1/lib/rack/builder.rb:51:in `initialize'
from config.ru:1:in `new'
from config.ru:1:in `<main>'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn.rb:44:in `eval'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn.rb:44:in `block in builder'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn_rails:139:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn_rails:139:in `block in rails_builder'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:673:in `call'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:673:in `build_app!'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:549:in `init_worker_process'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:567:in `worker_loop'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:475:in `spawn_missing_workers'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:486:in `maintain_worker_count'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/lib/unicorn/http_server.rb:270:in `join'
from /usr/local/lib/ruby/gems/1.9.1/gems/unicorn-4.0.1/bin/unicorn_rails:209:in `<top (required)>'
from /usr/local/bin/unicorn_rails:19:in `load'
from /usr/local/bin/unicorn_rails:19:in `<main>'
E, [2011-07-15T13:14:53.967107 #23269] ERROR -- : reaped #<Process::Status: pid 23274 exit 1> worker=0
I, [2011-07-15T13:14:53.967420 #23269] INFO -- : master complete
This project was working just fine in Windows (minus the Unicorn gem as it’s not compatible with Windows).
Project Gems
root@server-pc:/usr/local/blog# bundle list
Gems included by the bundle:
* actionmailer (3.1.0.rc4)
* actionpack (3.1.0.rc4)
* activemodel (3.1.0.rc4)
* activerecord (3.1.0.rc4)
* activeresource (3.1.0.rc4)
* activesupport (3.1.0.rc4)
* ansi (1.3.0)
* arel (2.1.3)
* bcrypt-ruby (2.1.4)
* builder (3.0.0)
* bundler (1.0.15)
* capistrano (2.6.0)
* devise (1.4.2)
* erubis (2.7.0)
* execjs (1.2.0)
* highline (1.6.2)
* hike (1.1.0)
* i18n (0.6.0)
* jquery-rails (1.0.12)
* kgio (2.6.0)
* libv8 (3.3.10.2)
* mail (2.3.0)
* mime-types (1.16)
* multi_json (1.0.3)
* net-scp (1.0.4)
* net-sftp (2.0.5)
* net-ssh (2.1.4)
* net-ssh-gateway (1.1.0)
* orm_adapter (0.0.5)
* polyglot (0.3.1)
* rack (1.3.0)
* rack-cache (1.0.2)
* rack-mount (0.8.1)
* rack-ssl (1.3.2)
* rack-test (0.6.0)
* rails (3.1.0.rc4)
* railties (3.1.0.rc4)
* raindrops (0.7.0)
* rake (0.9.2)
* rdoc (3.8)
* redcarpet (1.17.2)
* sass (3.1.4)
* sass-rails (3.1.0.rc.4)
* sprockets (2.0.0.beta.10)
* sqlite3 (1.3.3)
* therubyracer (0.9.2)
* thor (0.14.6)
* tilt (1.3.2)
* treetop (1.4.9)
* turn (0.8.2)
* tzinfo (0.3.29)
* uglifier (1.0.0)
* unicorn (4.0.1)
* warden (1.0.4)
Installed Gems (Not Necessarily Related to Rails Project)
root@server-pc:/usr/local/blog# gem list
*** LOCAL GEMS ***
actionmailer (3.1.0.rc4)
actionpack (3.1.0.rc4)
activemodel (3.1.0.rc4)
activerecord (3.1.0.rc4)
activeresource (3.1.0.rc4)
activesupport (3.1.0.rc4)
addressable (2.2.6)
ansi (1.3.0)
arel (2.1.3)
bcrypt-ruby (2.1.4)
builder (3.0.0)
bundler (1.0.15)
capistrano (2.6.1.pre, 2.6.0)
devise (1.4.2, 1.2.rc2)
erubis (2.7.0)
execjs (1.2.0)
faraday (0.5.7)
highline (1.6.2)
hike (1.1.0)
i18n (0.6.0)
jquery-rails (1.0.12)
kgio (2.6.0)
libv8 (3.3.10.2 x86-linux)
mail (2.3.0)
mime-types (1.16)
minitest (1.6.0)
multi_json (1.0.3, 0.0.5)
multipart-post (1.1.2)
net-ldap (0.1.1)
net-scp (1.0.4)
net-sftp (2.0.5)
net-ssh (2.1.4)
net-ssh-gateway (1.1.0)
nokogiri (1.4.7)
oa-basic (0.2.0.beta5)
oa-core (0.2.0.beta5)
oa-enterprise (0.2.0.beta5)
oa-more (0.2.0.beta5)
oa-oauth (0.2.0.beta5)
oa-openid (0.2.0.beta5)
oauth (0.4.5)
oauth2 (0.1.1)
omniauth (0.2.0.beta5)
orm_adapter (0.0.5)
polyglot (0.3.1)
pyu-ruby-sasl (0.0.3.3)
rack (1.3.1, 1.3.0)
rack-cache (1.0.2)
rack-mount (0.8.1)
rack-openid (1.2.0)
rack-ssl (1.3.2)
rack-test (0.6.0)
rails (3.1.0.rc4)
railties (3.1.0.rc4)
raindrops (0.7.0)
rake (0.9.2, 0.8.7)
rdoc (3.8, 2.5.8)
redcarpet (1.17.2)
rest-client (1.6.3)
ruby-openid (2.1.8)
ruby-openid-apps-discovery (1.2.0)
rubyntlm (0.1.1)
sass (3.1.4)
sass-rails (3.1.0.rc.4)
sprockets (2.0.0.beta.10)
sqlite3 (1.3.3)
therubyracer (0.9.2)
thor (0.14.6)
tilt (1.3.2)
treetop (1.4.9)
turn (0.8.2)
tzinfo (0.3.29)
uglifier (1.0.0)
unicorn (4.0.1, 4.0.0.2.g19f7)
warden (1.0.4)
Ruby Version
root@server-pc:/usr/local/blog# ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
This is on a server machine that I’m deploying it to, so I’d much rather have Ruby/Rails/Unicorn all as root.
Where can I go from here to get Unicorn to properly work? Is it a misconfiguration (or lack of configuration) on my part, or is it a bug in Unicorn?
If there is anything I’m missing to help you help me please let me know.
You have already activated rack 1.3.1, but your Gemfile requires rack 1.3.0. Consider using bundle exec.
…Consider using bundle exec.
…Consider using bundle exec.
..echo..