[oe] [meta-webserver][PATCH] nginx.service: sleep 0.1 after nginx start

Khem Raj raj.khem at gmail.com
Tue Feb 25 04:49:19 UTC 2020



On 2/24/20 7:53 PM, Changqing Li wrote:
> 
> On 2/25/20 12:40 AM, Khem Raj wrote:
>> On Mon, Feb 24, 2020 at 3:41 AM<changqing.li at windriver.com>  wrote:
>>> From: Changqing Li<changqing.li at windriver.com>
>>>
>>> Fix error info:
>>> nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
>>> invalid argument
>>>
>>> Signed-off-by: Changqing Li<changqing.li at windriver.com>
>>> ---
>>>   meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +
>>>   1 file changed, 1 insertion(+)
>>>
>>> diff --git a/meta-webserver/recipes-httpd/nginx/files/nginx.service b/meta-webserver/recipes-httpd/nginx/files/nginx.service
>>> index 9a6ca96..65c7752 100644
>>> --- a/meta-webserver/recipes-httpd/nginx/files/nginx.service
>>> +++ b/meta-webserver/recipes-httpd/nginx/files/nginx.service
>>> @@ -7,6 +7,7 @@ Type=forking
>>>   PIDFile=/run/nginx/nginx.pid
>>>   ExecStartPre=@SBINDIR@/nginx -t
>>>   ExecStart=@SBINDIR@/nginx
>>> +ExecStartPost=/bin/sleep 0.1
>> I dont thiink we should be adding sleeps instead try to lock the dependencies
>> so it happens correctly. or perhaps change the logic in code itself if
>> dependencies
>> can not handle it.
> 
> error info: "nginx.service: failed to parse pid from file 
> /run/nginx/nginx.pid: invalid argument" is caused by race condition between
> 
> systemd and nginx.  And this error will not caused problem except scary log
> 
> This should be a known problem: 
> https://bugs.launchpad.net/ubuntu/+source/nginx/+bug/1581864
> 
> other distro like ubuntu, fedora, should also have this problem, I can 
> google people report this error on different distro.

I do not question the problem but the solution, there have been 
different solutions posted to ml e.g.

https://mailman.nginx.org/pipermail/nginx-devel/2016-February/007961.html

or ubuntu fix

https://github.com/aroth-arsoft/pkg-nginx/blob/master/debian/patches/nginx-fix-pidfile.patch

perhaps you should try one of these patches

> 
> ubuntu 16.04 use this as a workaround.
> 
>>>   ExecReload=@SBINDIR@/nginx -s reload
>>>   ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
>>>   PrivateTmp=true
>>> --
>>> 2.7.4
>>>
>>> --
>>> _______________________________________________
>>> Openembedded-devel mailing list
>>> Openembedded-devel at lists.openembedded.org
>>> http://lists.openembedded.org/mailman/listinfo/openembedded-devel


More information about the Openembedded-devel mailing list