Skip to contentSkip to conversation

nginx.service: sleep 0.1 after nginx start

PATCH In review [email protected] 2 participants 8 messages Feb 24, 2020 – Feb 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nginx.service: sleep 0.1 after nginx start

From: Changqing Li <[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
 meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +
 1 file changed, 1 insertion(+)
meta-webserver/recipes-httpd/nginx/files/nginx.service +1 -0
index 9a6ca96..65c7752 100644
@@ -7,6 +7,7 @@ Type=forking
 PIDFile=/run/nginx/nginx.pid
 ExecStartPre=@SBINDIR@/nginx -t
 ExecStart=@SBINDIR@/nginx
+ExecStartPost=/bin/sleep 0.1
 ExecReload=@SBINDIR@/nginx -s reload
 ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
 PrivateTmp=true
Signature · 1 line
2.7.4
#1 lore raw
Quoted 17 lines · On Mon, Feb 24, 2020 at 3:41 AM <[email protected]> wrote:

From: Changqing Li <[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
 meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +
 1 file changed, 1 insertion(+)
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -0
index 9a6ca96..65c7752 100644

meta-webserver/recipes-httpd/nginx/files/nginx.service Type=forking · line 10

Quoted 4 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +1 -0
@@ -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.

Quoted 11 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -1
 ExecReload=@SBINDIR@/nginx -s reload
 ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
 PrivateTmp=true
--

2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#2 lore raw
Quoted 12 lines · Khem Raj
Quoted 11 lines · On Mon, Feb 24, 2020 at 3:41 AM <[email protected]> wrote:

From: Changqing Li <[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
  meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +
  1 file changed, 1 insertion(+)
Quoted 13 lines

meta-webserver/recipes-httpd/nginx/files/nginx.service Type=forking · line 10

Quoted 9 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +1 -0
index 9a6ca96..65c7752 100644
@@ -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.

Quoted 12 lines
Quoted 12 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -1
  ExecReload=@SBINDIR@/nginx -s reload
  ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
  PrivateTmp=true
--

2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#3 lore raw
Quoted 30 lines · Changqing Li
Quoted 12 lines · Khem Raj
Quoted 11 lines · On Mon, Feb 24, 2020 at 3:41 AM <[email protected]> wrote:

From: Changqing Li <[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
  meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +

  1 file changed, 1 insertion(+)
Quoted 13 lines
Quoted 9 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -0
index 9a6ca96..65c7752 100644
@@ -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

Quoted 7 lines

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.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

  ExecReload=@SBINDIR@/nginx -s reload
  ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
  PrivateTmp=true

Signature · 7 lines
2.7.4

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
#4 lore raw
In reply to Changqing Li
Quoted 28 lines · Changqing Li
Quoted 12 lines · Khem Raj
Quoted 11 lines · On Mon, Feb 24, 2020 at 3:41 AM<[email protected]> wrote:

From: Changqing Li<[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
  meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +
  1 file changed, 1 insertion(+)
Quoted 13 lines

meta-webserver/recipes-httpd/nginx/files/nginx.service Type=forking · line 10

Quoted 9 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +1 -0
index 9a6ca96..65c7752 100644
@@ -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.

Quoted 7 lines

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

Quoted 14 lines

ubuntu 16.04 use this as a workaround.

Quoted 11 lines
Quoted 11 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -1
  ExecReload=@SBINDIR@/nginx -s reload
  ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
  PrivateTmp=true
--

2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

#5 lore raw
Quoted 39 lines · Khem Raj
Quoted 28 lines · Changqing Li
Quoted 12 lines · Khem Raj
Quoted 11 lines · On Mon, Feb 24, 2020 at 3:41 AM<[email protected]>  wrote:

From: Changqing Li<[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
  meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +

  1 file changed, 1 insertion(+)
Quoted 13 lines
Quoted 9 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -0
index 9a6ca96..65c7752 100644
@@ -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.

Quoted 7 lines

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.

Quoted 8 lines

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

Thanks.  I send a V2 with this solution.

Quoted 18 lines

perhaps you should try one of these patches

Quoted 14 lines

ubuntu 16.04 use this as a workaround.

Quoted 11 lines
Quoted 11 lines

  ExecReload=@SBINDIR@/nginx -s reload
  ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
  PrivateTmp=true

Signature · 7 lines
2.7.4

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
#6 lore raw
In reply to Khem Raj
Quoted 41 lines · Khem Raj
Quoted 28 lines · Changqing Li
Quoted 12 lines · Khem Raj
Quoted 11 lines · On Mon, Feb 24, 2020 at 3:41 AM<[email protected]>  wrote:

From: Changqing Li<[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
  meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +

  1 file changed, 1 insertion(+)
Quoted 13 lines
Quoted 9 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -0
index 9a6ca96..65c7752 100644
@@ -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.

Quoted 7 lines

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.

Quoted 8 lines

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

Hi, Khem

I found that both V1 and V2 are on master-next now,  please remember to drop the V1 when merge to master, thanks.

Quoted 16 lines
Quoted 15 lines

ubuntu 16.04 use this as a workaround.

Quoted 11 lines
Quoted 11 lines

  ExecReload=@SBINDIR@/nginx -s reload
  ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
  PrivateTmp=true

Signature · 7 lines
2.7.4

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel
#7 lore raw
Quoted 58 lines · Changqing Li
Quoted 56 lines · Khem Raj
Quoted 34 lines · Changqing Li
Quoted 12 lines · Khem Raj
Quoted 11 lines · On Mon, Feb 24, 2020 at 3:41 AM<[email protected]>  wrote:

From: Changqing Li<[email protected]>

Fix error info:
nginx.service: failed to parse pid from file /run/nginx/nginx.pid:
invalid argument

---
  meta-webserver/recipes-httpd/nginx/files/nginx.service | 1 +

  1 file changed, 1 insertion(+)
Quoted 15 lines
Quoted 10 lines
meta-webserver/recipes-httpd/nginx/files/nginx.service +0 -0
index 9a6ca96..65c7752 100644
@@ -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

Quoted 8 lines

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

Quoted 7 lines
Quoted 1 line

perhaps you should try one of these patches

Hi, Khem

I found that both V1 and V2 are on master-next now,  please remember to drop the V1 when merge to master, thanks.

thanks, I needed to refresh master-next queue anyway, I will drop this at that time

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines

ubuntu 16.04 use this as a workaround.

Quoted 11 lines
Quoted 11 lines

  ExecReload=@SBINDIR@/nginx -s reload
  ExecStop=@BASE_BINDIR@/kill -s QUIT $MAINPID
  PrivateTmp=true
--
2.7.4

--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel