[PATCH] Workaround for systemd error messages about nginx pid file.
Maxim Dounin
mdounin at mdounin.ru
Wed Nov 29 12:30:54 UTC 2017
Hello!
On Wed, Nov 29, 2017 at 12:33:28PM +0200, Gena Makhomed wrote:
> # HG changeset patch
> # User Gena Makhomed <gmm at csdoc.com>
> # Date 1511951401 -7200
> # Wed Nov 29 12:30:01 2017 +0200
> # Node ID b529ea784244e13d8a5e58a12c8b639351652057
> # Parent fc0d06224edac2c7cfbfd9a4def478f285d9957b
> Workaround for systemd error messages about nginx pid file.
>
> Race condition exists between nginx writing and systemd reading pid file.
> Sometimes systemd can produce error messages about nginx pid file:
>
> systemd: Failed to read PID from file /var/run/nginx.pid: Invalid argument
> systemd: PID file /var/run/nginx.pid not readable (yet?) after start.
>
> This patch add small delay before nginx original process exit
> to eliminate race condition between nginx and systemd.
>
> diff -r fc0d06224eda -r b529ea784244 src/os/unix/ngx_daemon.c
> --- a/src/os/unix/ngx_daemon.c Tue Nov 28 13:09:54 2017 +0300
> +++ b/src/os/unix/ngx_daemon.c Wed Nov 29 12:30:01 2017 +0200
> @@ -23,6 +23,7 @@
> break;
>
> default:
> + ngx_msleep(100);
> exit(0);
> }
No, thanks. As a systemd-specific workaround this definitely
should be in the service unit file instead, if at all. Moreover, as
previously explained, the message in question is harmless and the
workaround is not needed for anything but silencing the message.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list