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

Changqing Li changqing.li at windriver.com
Tue Feb 25 04:45:41 UTC 2020


On 2/25/20 11:53 AM, 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.
>
> ubuntu 16.04 use this as a workaround.

But ubuntu 18.04,  fedora30, centos8 seems still have this error info,  
I just googled it, not test verified on every distro.

maybe other distro select to just let it report this error.

>
>>
>>>   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