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

Nginx doesn't restart or reload #125

Open
vkurup opened this issue Mar 4, 2016 · 7 comments
Open

Nginx doesn't restart or reload #125

vkurup opened this issue Mar 4, 2016 · 7 comments

Comments

@vkurup
Copy link
Contributor

vkurup commented Mar 4, 2016

The upstart script included with Nginx via the PPA doesn't work.

reload fails with an incorrect error message.

vkurup@ip-10-151-109-228:~$ sudo service nginx reload
reload: Not running

restart claims to work but doesn't actually restart the processes:

vkurup@ip-10-151-109-228:~$ ps auxw | grep nginx
www-data  5631  0.0  0.1  76168  1900 ?        S    16:10   0:00 nginx: worker process
www-data  5632  0.0  0.2  76320  3852 ?        S    16:10   0:00 nginx: worker process
www-data  5633  0.0  0.1  76168  1900 ?        S    16:10   0:00 nginx: worker process
www-data  5634  0.0  0.1  76168  3124 ?        S    16:10   0:00 nginx: worker process
vkurup    6210  0.0  0.0   8100   936 pts/2    S+   16:17   0:00 grep --color=auto nginx
root      6920  0.0  0.2  75856  4408 ?        S    Feb01   0:00 nginx: master process /usr/sbin/nginx
vkurup@ip-10-151-109-228:~$ sudo service nginx restart
nginx stop/waiting
nginx start/running
vkurup@ip-10-151-109-228:~$ ps auxw | grep nginx
www-data  5631  0.0  0.1  76168  1900 ?        S    16:10   0:00 nginx: worker process
www-data  5632  0.0  0.2  76320  3852 ?        S    16:10   0:00 nginx: worker process
www-data  5633  0.0  0.1  76168  1900 ?        S    16:10   0:00 nginx: worker process
www-data  5634  0.0  0.1  76168  3124 ?        S    16:10   0:00 nginx: worker process
vkurup    6251  0.0  0.0   8100   936 pts/2    S+   16:18   0:00 grep --color=auto nginx
root      6920  0.0  0.2  75856  4408 ?        S    Feb01   0:00 nginx: master process /usr/sbin/nginx

Possible workarounds:

@vkurup
Copy link
Contributor Author

vkurup commented Mar 8, 2016

Just to complicate this a little...

The above commands were from Duckling's staging server. I ran the same commands on Duckling's production server (identical OS, versions etc, just a larger machine) and they worked fine. So it seems that this issue may be intermittent from server to server...

@mlavin
Copy link
Contributor

mlavin commented Mar 8, 2016

What version of Nginx is running on those servers?

@vkurup
Copy link
Contributor Author

vkurup commented Mar 8, 2016

nginx version: nginx/1.8.1

on both staging and production.

@mlavin
Copy link
Contributor

mlavin commented Mar 8, 2016

Could this be only an issue for projects which were installed at 1.8.X vs those which were installed on an earlier version and later upgraded to 1.8.X. Grasping at straws here.

@vkurup
Copy link
Contributor Author

vkurup commented Mar 8, 2016

Hmmm... that is plausible. I could see how changing init scripts might mess things up. Staging was provisioned way before production, in this case.

@vkurup
Copy link
Contributor Author

vkurup commented Mar 8, 2016

That was it! Staging's nginx had been started before the PPA was installed. Once I manually killed the master process, then all the upstart commands started working normally.

Here's one way to tell if you're running an "old" master process:

vkurup$ ps auxw | grep 'nginx: master'
root      6920  0.0  0.2  75856  4408 ?        S    Feb01   0:00 nginx: master process /usr/sbin/nginx

The PPA version should have some command line parameters. It should look like this:

vkurup$ ps auxw | grep 'nginx: master'
root     18338  0.0  0.1  75864  3100 ?        Ss   16:30   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;

To fix it, kill the "old" process and then use the normal upstart commands:

vkurup$ sudo kill `cat /var/run/nginx.pid`
vkurup$ sudo reload nginx

It seems it would need a 1-time fix on any server that was running the Ubuntu-provided nginx and then upgraded to the PPA. Not sure if we should do that manually across our servers, or write something in salt to do it.

@dpoirier
Copy link
Contributor

The annoying thing about this problem is that there's nothing wrong with these systems' configurations; they've just in a state they can't get themselves out of in the normal course of deploying to them. A simple reboot would sort it out.

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

No branches or pull requests

3 participants