Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.2.0 failed to restart unicon due to incorrect pid file path #85

Open
chengguangnan opened this issue Nov 5, 2013 · 15 comments · May be fixed by #88
Open

v0.2.0 failed to restart unicon due to incorrect pid file path #85

chengguangnan opened this issue Nov 5, 2013 · 15 comments · May be fixed by #88

Comments

@chengguangnan
Copy link

I noticed that this gem failed to restart unicorn after I upgraded to v0.2.0, due to the missing of app_path.

0.2.0

executing "if [ -e tmp/pids/unicorn.pid ] &&  kill -0 `cat tmp/pids/unicorn.pid` >

0.1.10

executing "if [ -e /u/apps/avcloud/current/tmp/pids/unicorn.pid ] &&  kill -0 `cat /u/apps/avcloud/current/tmp/pids/unicor

I'm using a multistage cap. Not sure if that's related.

It happens on unicorn:stop, restart etc.

@cschramm
Copy link

+1

2 similar comments
@jnimety
Copy link

jnimety commented Nov 14, 2013

+1

@glebtv
Copy link

glebtv commented Nov 21, 2013

+1

@glebtv
Copy link

glebtv commented Nov 21, 2013

As I understand relative paths to pid file in config/unicorn.rb stopped working, now it works only with absolute path.

@michalorman
Copy link

In my case I'm receiving:

 * 2013-12-05 10:18:00 executing `unicorn:reload'
    triggering before callbacks for `unicorn:reload'
/tmp/unicorn.rb20131205-11768-d8q40k:7:in `read': No such file or directory - config/unicorn/production.rb (Errno::ENOENT)
        from /tmp/unicorn.rb20131205-11768-d8q40k:7:in `reload'
        from /home/morman/.gem/ruby/1.9.3/gems/unicorn-4.7.0/lib/unicorn/configurator.rb:75:in `instance_eval'
        from /home/morman/.gem/ruby/1.9.3/gems/unicorn-4.7.0/lib/unicorn/configurator.rb:75:in `reload'
        from /home/morman/.gem/ruby/1.9.3/gems/unicorn-4.7.0/lib/unicorn/configurator.rb:68:in `initialize'
        from /home/morman/.gem/ruby/1.9.3/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:108:in `new'
        from /home/morman/.gem/ruby/1.9.3/gems/unicorn-4.7.0/lib/unicorn/http_server.rb:108:in `initialize'
        from /home/morman/.gem/ruby/1.9.3/gems/unicorn-4.7.0/bin/unicorn:126:in `new'
        from /home/morman/.gem/ruby/1.9.3/gems/unicorn-4.7.0/bin/unicorn:126:in `<top (required)>'
        from /home/morman/.gem/ruby/1.9.3/bin/unicorn:23:in `load'
        from /home/morman/.gem/ruby/1.9.3/bin/unicorn:23:in `<main>'
*** err :: failed to auto-detect pid from config/unicorn/production.rb
*** err :: falling back to default: /home/deploy/web/printbox/current/tmp/pids/unicorn.pid

Even though config/unicorn/production.rb exists in rails app. Works fine with 0.1.10.

@k2nr
Copy link

k2nr commented Dec 12, 2013

Maybe the bug is related to my case.

I set pid in config/unicorn/production.rb like this:

pid File.expand_path('tmp/pids/unicorn.pid', ENV['RAILS_ROOT']).to_s

From 0.2.0 capistrano-unicorn auto-detects pid path from the config file and pid above is evaluated at local machine which is different from server's path.

I think:

  • Auto-detecting should run on server's environment and then
  • For relative path, the path extracted here should be wrapped by File.expand_path

@sfsekaran
Copy link
Contributor

@k2nr Sounds great! Would you please send us a pull request with that patch? If you could add/fix/identify relevant specs, that'd be excellent.

@k2nr k2nr linked a pull request Dec 13, 2013 that will close this issue
@aspiers
Copy link
Contributor

aspiers commented Dec 13, 2013

@guangnan, @cschramm, @jnimety, @glebtv, @michalorman - it would help us a lot in fully understanding this issue if you could provide:

  • the value of unicorn_pid (if any) in your capistrano config file, and
  • the value of pid in your unicorn config file

@cschramm
Copy link

pid 'tmp/pids/unicorn.pid'

@aspiers
Copy link
Contributor

aspiers commented Dec 13, 2013

@k2nr, @sfsekaran - I already carefully considered server-side detection, tried to implement it, and then rejected it. So I'm not yet convinced this is the way to go.

@RobWu
Copy link

RobWu commented Dec 13, 2013

pid "/var/www/app_name/shared/pids/unicorn.pid"

@jnimety
Copy link

jnimety commented Dec 13, 2013

pid File.expand_path('../../../tmp/pids/unicorn.pid', __FILE__)

@lecoueyl
Copy link

I had this error and fixed it setting the pid folder in my capistrano deploy file:
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"

@chengguangnan chengguangnan changed the title version 0.2.0 fails with some pid file values v0.2.0 failed to restart unicon due to incorrect pid file path Jan 21, 2015
@wonook
Copy link

wonook commented Jan 27, 2015

@lecoueyl
Awesome! it worked well
I think capistrano is having trouble with unicorn on recognising the pids and it seems like a good solution doing the job manually.

@lecoueyl
Copy link

In fact, this is the default folder setting in capistrano-unicorn.
But capistrano is not setting it so you have to do it by hand :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.