usnistgov / SpectrumBrowser

ITL
12 stars 11 forks source link

Gunicorn doesn't clean up pidfile if statup fails #184

Closed djanderson closed 9 years ago

djanderson commented 9 years ago

Another probable upstream issue, here so I can keep track of it.

$ sudo gunicorn --daemon --pid /var/run/gunicorn/gunicorn.pid flaskr:app
$ tail -n 12 /var/log/gunicorn/error.log 
2015-05-27 15:12:29 [20791] [INFO] Starting gunicorn 17.5
2015-05-27 15:12:29 [20791] [ERROR] Connection in use: ('0.0.0.0', 8000)
2015-05-27 15:12:29 [20791] [ERROR] Retrying in 1 second.
2015-05-27 15:12:30 [20791] [ERROR] Connection in use: ('0.0.0.0', 8000)
2015-05-27 15:12:30 [20791] [ERROR] Retrying in 1 second.
2015-05-27 15:12:31 [20791] [ERROR] Connection in use: ('0.0.0.0', 8000)
2015-05-27 15:12:31 [20791] [ERROR] Retrying in 1 second.
2015-05-27 15:12:32 [20791] [ERROR] Connection in use: ('0.0.0.0', 8000)
2015-05-27 15:12:32 [20791] [ERROR] Retrying in 1 second.
2015-05-27 15:12:33 [20791] [ERROR] Connection in use: ('0.0.0.0', 8000)
2015-05-27 15:12:33 [20791] [ERROR] Retrying in 1 second.
2015-05-27 15:12:34 [20791] [ERROR] Can't connect to ('0.0.0.0', 8000)
$ cat /var/run/gunicorn/gunicorn.pid
20791
$ kill $(cat /var/run/gunicorn/gunicorn.pid)
bash: kill: (20791) - No such process
djanderson commented 9 years ago

Worked around the issue by using killproc from /lib/lsb/init-functions, which cleans daemon's pid after it kills the process.