2

The premise of this question is unfortunately vague but I can't pinpoint a more specific issue. I upgraded a machine from nginx 1.6.3 to 1.8 and now issuing a nginx -s quit does literally nothing. The command gives no output, the access_log and error_log files show nothing abnormal, even with the debug level enabled in all vhosts. There is also nothing in /var/log/nginx/error.log other than "signal process started" notices. pgrep nginx show that the processes stay there like nothing happened.

I understand that the quit signal doesn't necessarily stop nginx immediately since it's supposed to quit gracefully, but the issue here is that even if the machine is firewalled, isolated, and processing no requests, nginx -s quit still does nothing. Under the exact same conditions with 1.6.3 the processes stop immediately.

I'm at a complete loss at how debug this issue and find the root cause but obviously something is amiss. Any help to point me into the right direction would be much appreciated.

Edit: The behaviour we are seeing is the following, step by step:

  1. apt-get update/upgrade a machine with nginx 1.6.3 to 1.8 (when prompted install the new /etc/nginx/nginx.conf)
  2. sudo nginx -s quit for the first time works as expected
  3. sudo service nginx start brings nginx back as expected
  4. sudo nginx -s quit for the second time does nothing any longer, and will stay as such even after rebooting

We tested this multiple times in a VM and the results are consistent. Perhaps it's a bug in 1.8?

  • 1
    What happens if you send the relevant signal to the nginx process manually (i.e. kill -QUIT)? If that works, contents of pid file could be simply wrong (i.e. point to nonexistent process) for some reason. – sendmoreinfo Jul 1 '15 at 21:23
  • @sendmoreinfo will check that, thanks for the tip. – Mahn Jul 1 '15 at 21:51
0

For some reason that we haven't located yet, on our environment nginx creates two pid files: /run/nginx.pid and /var/run/nginx.pid. This appears to happen regardless the nginx version so it seems it's not a nginx bug per se.

Running nginx -s quit does not kill and delete the pids as it should, but service nginx stop does. So in order to do a graceful restart in an up-to-date nginx version we have to run both:

  1. sudo nginx -s quit
  2. sudo service nginx stop (after a minute or so to give time for the graceful quit)
  3. sudo service nginx start

Subsequent quit signals will work fine then, as long as nginx is stopped via the service command to ensure the pids don't lag around.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.