Lennart Poettering
2018-05-17 17:23:15 UTC
Hi,
I have a service unit for nginx that uses Type=forking and PIDFile.
That works, but occasionally I see in the log a message like
nginx.service: PID file /run/nginx/nginx.pid not readable (yet?) after
start: No such file or directory
So yes, this is a bug in nginx. They really should fix that. And thisI have a service unit for nginx that uses Type=forking and PIDFile.
That works, but occasionally I see in the log a message like
nginx.service: PID file /run/nginx/nginx.pid not readable (yet?) after
start: No such file or directory
is not only broken when you use systemd, but on sysvinit too, as a
command like this would likely fail there too: "service nginx start
service nginx status", as the start would return before the PID file
is written, and then status would claim the service to be down...
Hence, please file a bug against nginx asking them to wait in the
parent until the PID file is fully written before exiting. It's how
this works on SysV systems, and systemd wants that too.
but that busy waits. Is there any option to replace this hack via a
native systemd solution, like explicitly waiting for the pid file to
appear before considering the unit ready?
As others indicated, the best approach would be to do Type=notify, andnative systemd solution, like explicitly waiting for the pid file to
appear before considering the unit ready?
patch nginx to send out the right ready message after it wrote the PID
file. That'd be the native systemd solution.
PID files suck (as they have no clear clean-up regime), but if
services use them, then they should really implement them properly,
and thus write them before exiting in the forking parent.
Lennart
--
Lennart Poettering, Red Hat
Lennart Poettering, Red Hat