Bug 1869026

Summary: nginx.service fails to parse /run/nginx.pid
Product: [Fedora] Fedora Reporter: Georg Sauthoff <fedora>
Component: nginxAssignee: Felix Kaechele <felix>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 32CC: affix, athmanem, hello, jeremy, jkaluza, jorton, luhliari, pavel.lisy, tadej.j, wtogami
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nginx-1.20.0-2.fc33 nginx-1.20.0-2.fc32 nginx-1.20.0-2.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-04-29 00:57:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Georg Sauthoff 2020-08-15 15:30:12 UTC
Description of problem:
Looks like there is a race between /run/nginx.pid being written during startup and systemd reading it.

Version-Release number of selected component (if applicable):
nginx-1.18.0-1.fc32.x86_64

How reproducible:
always, might depend on fast storage

Steps to Reproduce:
1. install nginx/setup some basic config, e.g. one without any server blocks
2. systemctl restart nginx
3. systemctl status nginx

Actual results:
● nginx.service - The nginx HTTP and reverse proxy server
     Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
     Active: active (running) since Sat 2020-08-15 15:13:50 UTC; 20s ago
    Process: 73329 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
    Process: 73330 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
    Process: 73331 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
   Main PID: 73332 (nginx)
      Tasks: 2 (limit: 2344)
     Memory: 2.6M
        CPU: 30ms
     CGroup: /system.slice/nginx.service
             ├─73332 nginx: master process /usr/sbin/nginx
             └─73333 nginx: worker process

Aug 15 15:13:50 example.org systemd[1]: Starting The nginx HTTP and reverse proxy server...
Aug 15 15:13:50 example.org nginx[73330]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Aug 15 15:13:50 example.org nginx[73330]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Aug 15 15:13:50 example.org systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument
Aug 15 15:13:50 example.org systemd[1]: Started The nginx HTTP and reverse proxy server

Expected results:
Similar status output but without this error:

Aug 15 15:13:50 example.org systemd[1]: nginx.service: Failed to parse PID from file /run/nginx.pid: Invalid argument

Additional info:
Googling for this yields quite a few reports from nginx Ubuntu users and some seem to work around this with a service override that adds a small sleep to the startup ...

Comment 1 Georg Sauthoff 2020-08-15 15:57:04 UTC
PS: The PID file is there and looks plausible - after another restart:

cat /run/nginx.pid
73368
ps -e |  grep $(cat /run/nginx.pid) 
  73368 ?        00:00:00 nginx


Can also reproduce this with a `systemctl stop` `stystemctl start` sequence.

Comment 2 Fedora Update System 2021-04-21 02:45:41 UTC
FEDORA-2021-c0243589ee has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-c0243589ee

Comment 3 Fedora Update System 2021-04-21 02:45:54 UTC
FEDORA-2021-0d3d0559f7 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-0d3d0559f7

Comment 4 Fedora Update System 2021-04-21 02:46:06 UTC
FEDORA-2021-2cf5ad411d has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-2cf5ad411d

Comment 5 Fedora Update System 2021-04-21 15:01:21 UTC
FEDORA-2021-c0243589ee has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-c0243589ee`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-c0243589ee

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2021-04-21 17:02:44 UTC
FEDORA-2021-10c1cd4cba has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2021-10c1cd4cba

Comment 7 Fedora Update System 2021-04-21 17:03:02 UTC
FEDORA-2021-1556d440ba has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2021-1556d440ba

Comment 8 Fedora Update System 2021-04-21 17:03:20 UTC
FEDORA-2021-3aa9ac7fd1 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-3aa9ac7fd1

Comment 9 Fedora Update System 2021-04-21 21:51:50 UTC
FEDORA-2021-1556d440ba has been pushed to the Fedora 32 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-1556d440ba`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-1556d440ba

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2021-04-21 22:02:01 UTC
FEDORA-2021-10c1cd4cba has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-10c1cd4cba`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-10c1cd4cba

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2021-04-22 18:24:32 UTC
FEDORA-2021-3aa9ac7fd1 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-3aa9ac7fd1`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-3aa9ac7fd1

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2021-04-29 00:57:28 UTC
FEDORA-2021-10c1cd4cba has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2021-04-29 01:22:09 UTC
FEDORA-2021-1556d440ba has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 14 Fedora Update System 2021-04-30 00:54:58 UTC
FEDORA-2021-3aa9ac7fd1 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.