Gitlab init script fails to launch unicorn at boot, succeeds afterwards #598

Closed
mcdelorme opened this Issue Mar 26, 2012 · 2 comments

Projects

None yet

4 participants

@mcdelorme

Hello,

I've installed Gitlab on Ubuntu 10.04 as per the installtion instructions here:

https://github.com/gitlabhq/gitlabhq/blob/stable/doc/installation.md

It seems as though when the provided init script launches at boot, unicorn fails to load the application. If I manually relaunch the init script after I log in, however, it seems to work. I added the "-d" flag to the end of the DAEMON_OPTS line to help diagnose the problem. The following is the unsuccessful output I get at boot time:

Starting Gitlab service:
{:unicorn_options=>
  {:listeners=>[], :config_file=>"/home/gitlab/gitlab/config/unicorn.rb"},
 :app=>
  #<Proc:0x00000001a3d3f0@/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/bin/unicorn_rails:135 (lambda)>,
 :daemonize=>true}
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/cache
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/pids
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/sessions
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/sockets
unicorn.
Exception `EOFError' at /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/launcher.rb:46 - end of file reached
master failed to start, check stderr log for details
unicorn.

On the other hand, if I run sudo /etc/init.d/gitlab start after the machine comes up, the application comes up successfully with the following output:

Starting Gitlab service:
{:unicorn_options=>
  {:listeners=>[], :config_file=>"/home/gitlab/gitlab/config/unicorn.rb"},
 :app=>
  #<Proc:0x00000001a3d3f0@/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/bin/unicorn_rails:135 (lambda)>,
 :daemonize=>true}
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/cache
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/pids
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/sessions
Exception `Errno::EEXIST' at /usr/local/lib/ruby/1.9.1/fileutils.rb:243 - File exists - tmp/sockets
unicorn.

Any ideas as to what could be going on?

Thanks,
Mike

Contributor
arenard commented Mar 27, 2012

Hello,

I encounter the same issue with an up to date Ubuntu 11.10. I made GitLab init script executable and successfully added it to startup scripts but it is not starting automatically with the server. If I run it manually with sudo /etc/init.d/gitlab start later, it is working like a charm.

Here is what I get in stderr log file (/home/gitlab/gitlab/log/unicorn.stderr.log) mentioned in the message master failed to start, check stderr log for details :

I, [2012-03-27T10:44:13.923318 #1521]  INFO -- : reaped #<Process::Status: pid 1528 exit 0> worker=0
I, [2012-03-27T10:44:13.923754 #1521]  INFO -- : reaped #<Process::Status: pid 1531 exit 0> worker=1
I, [2012-03-27T10:44:13.924107 #1521]  INFO -- : master complete
I, [2012-03-27T10:46:42.933537 #866]  INFO -- : listening on addr=/tmp/gitlab.socket fd=3
I, [2012-03-27T10:46:43.030670 #866]  INFO -- : Refreshing Gem list
/home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:236:in `rescue in establish_connection': Connection refused - Unable to connect to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:222:in `establish_connection'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:23:in `connect'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:247:in `ensure_connected'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:137:in `block in process'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:206:in `logging'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:136:in `process'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis/client.rb:46:in `call'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis.rb:435:in `block in sadd'
    from /usr/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-2.2.2/lib/redis.rb:434:in `sadd'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/redis-namespace-1.0.3/lib/redis/namespace.rb:213:in `method_missing'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/resque-1.20.0/lib/resque.rb:205:in `watch_queue'
    from /home/gitlab/gitlab/config/initializers/gitlabhq/30_resque_queues.rb:1:in `<top (required)>'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `block in load'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:245:in `load'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `each'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/engine.rb:587:in `block in <class:Engine>'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/gitlab/gitlab/config/environment.rb:5:in `<top (required)>'
    from config.ru:4:in `require'
    from config.ru:4:in `block in <main>'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
    from config.ru:1:in `new'
    from config.ru:1:in `<main>'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn.rb:44:in `eval'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn.rb:44:in `block in builder'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/bin/unicorn_rails:139:in `call'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/bin/unicorn_rails:139:in `block in rails_builder'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:691:in `call'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:691:in `build_app!'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/lib/unicorn/http_server.rb:136:in `start'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/unicorn-4.2.0/bin/unicorn_rails:209:in `<top (required)>'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/bin/unicorn_rails:19:in `load'
    from /home/gitlab/gitlab/vendor/bundle/ruby/1.9.1/bin/unicorn_rails:19:in `<main>'

I hope it will help to solve the issue.

Thanks,
Arnaud

mksplg commented Mar 30, 2012

I had the same error as mcdelorme, but also when starting gitlab manually. For me it was because I did not config nginx as described in the install instructions. Maybe this helps finding the issue.

@randx randx closed this in e384552 Apr 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment