Ruby - no PID found in tmp/pids/thin.pid (Thin::Pi

2019-07-07 07:38发布

问题:

I'm trying to start thin for my app but then the pid cannot be generated:

$ thin -C /var/www/project_path/current/config/myproject.testing.yml start

Now I can't stop it because there is no pid:

 $ thin -C /var/www/project_path/current/config/myproject.testing.yml stop

   /home/usr/.rvm/gems/ruby-1.9.2-p180@api/gems/thin-1.5.1/lib/thin/daemonizing.rb:131:in `send_signal': Can't stop process, no PID found in tmp/pids/thin.pid (Thin::PidFileNotFound)

This is the yml file:

pid: /home/usr/htdocs/testing/myproject/shared/pids/thin.pid
rackup: config.ru
log: /home/usr/htdocs/testing/myproject/shared/log/thin.log
timeout: 30
port: 1234
max_conns: 1024
chdir: /home/usr/htdocs/testing/myproject/current
max_persistent_conns: 128
environment: testing
address: 127.0.0.1
require: []

daemonize: true

update:

Now I can start the server but after some seconds process vanish automatically; means I can't see the pid which was generated by starting the server after some seconds.

回答1:

lsof -wni tcp:1234

will give you the process ID

kill -9 PID

will kill the process



回答2:

I had exactly the same annoying problem

I've found that if the server crashes on startup, the pid file gets created but there is no pid in the file. Try cat'ing the log file for the server ./logs/thin.3001.log and look for errors. You could also try starting the server manually via

rails s -p 3000

and see if there are any errors thrown.

Good luck

Chris