invalid PID number

1,651 views
Skip to first unread message

Matthieu Labour

unread,
Dec 11, 2014, 1:47:53 PM12/11/14
to openre...@googlegroups.com
Hello

I am getting the following error

ubuntu@ip-XXX-XXX-XXX-XXX:~$ sudo /usr/local/openresty/nginx/sbin/nginx -s reload
nginx: [error] invalid PID number "" in "/var/run/nginx.pid"


However openresty has been running smoothly since Dec02.
 
ubuntu@ip-XXX-XXX-XXX-XXX:~$ ps aux | grep nginx

root 448 0.0 0.0 8124052 6316 ? Ss Dec02 0:00 nginx: master process /usr/local/openresty/nginx/sbin/nginx
nobody 449 41.8 15.7 8166960 2420872 ? R Dec02 5800:35 nginx: worker process
nobody 450 41.8 15.6 8158360 2409652 ? R Dec02 5803:15 nginx: worker process
nobody 451 41.9 15.6 8161464 2415788 ? R Dec02 5810:24 nginx: worker process
nobody 452 41.8 15.6 8157508 2413324 ? S Dec02 5805:04 nginx: worker process
ubuntu 13175 0.0 0.0 10464 916 pts/1 R+ 18:34 0:00 grep --color=auto nginx

and the nginx.conf config never changed and shows

pid /var/run/nginx.pid;

I am wondering what happened there.

Thank you for your help.

Yichun Zhang (agentzh)

unread,
Dec 11, 2014, 2:19:46 PM12/11/14
to openresty-en
Hello!

On Thu, Dec 11, 2014 at 10:47 AM, Matthieu Labour wrote:
> I am getting the following error
>
> ubuntu@ip-XXX-XXX-XXX-XXX:~$ sudo /usr/local/openresty/nginx/sbin/nginx -s
> reload
> nginx: [error] invalid PID number "" in "/var/run/nginx.pid"
>

Seems like the /var/run/nginx.pid file is overwritten by something
else? You can cat this .pid file to see its content. It's most likely
that you have some other random processes updating this .pid file for
some reason.

BTW, -s reload is not recommended to control nginx on *NIX systems.
It's much better and efficient to directly send the HUP signal to the
nginx master process. See

http://nginx.org/en/docs/control.html

Regards,
-agentzh

Daurnimator

unread,
Dec 18, 2014, 5:03:03 PM12/18/14
to openre...@googlegroups.com
On 11 December 2014 at 14:19, Yichun Zhang (agentzh) <age...@gmail.com> wrote:
> BTW, -s reload is not recommended to control nginx on *NIX systems.
> It's much better and efficient to directly send the HUP signal to the
> nginx master process. See
>
> http://nginx.org/en/docs/control.html
>
> Regards,
> -agentzh

This is surprising to me:
I would have suspected '-s reload' to only exit once the reload
succeeds (or exit with a non-zero exit code).
Using a signal (i.e. HUP), you have no idea if the operation was a
success (without delving into log files).

Yichun Zhang (agentzh)

unread,
Dec 18, 2014, 5:08:22 PM12/18/14
to openresty-en
Hello!

On Thu, Dec 18, 2014 at 2:02 PM, Daurnimator wrote:
> This is surprising to me:
> I would have suspected '-s reload' to only exit once the reload
> succeeds (or exit with a non-zero exit code).
> Using a signal (i.e. HUP), you have no idea if the operation was a
> success (without delving into log files).
>

I think you should use nginx -t before sending HUP for this.

Regards,
-agentzh
Reply all
Reply to author
Forward
0 new messages