diff mbox series

[OpenWrt-Devel,v2,1/1] rpcd: add respawn param

Message ID 20191107133129.8740-1-fe@dev.tdt.de
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [OpenWrt-Devel,v2,1/1] rpcd: add respawn param | expand

Commit Message

Florian Eckert Nov. 7, 2019, 1:31 p.m. UTC
The rpcd service is an important service, but if the service stops
working for any reason, no one will ever respawn that service. With this
commit, the procd service will monitor if the rpcd service
is running. If the rpcd service has crashed, then
procd respawns the rpcd service.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
---
 package/system/rpcd/Makefile        | 2 +-
 package/system/rpcd/files/rpcd.init | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Hauke Mehrtens Nov. 9, 2019, 12:53 p.m. UTC | #1
On 11/7/19 2:31 PM, Florian Eckert wrote:
> The rpcd service is an important service, but if the service stops
> working for any reason, no one will ever respawn that service. With this
> commit, the procd service will monitor if the rpcd service
> is running. If the rpcd service has crashed, then
> procd respawns the rpcd service.
> 
> Signed-off-by: Florian Eckert <fe@dev.tdt.de>
> ---
>  package/system/rpcd/Makefile        | 2 +-
>  package/system/rpcd/files/rpcd.init | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
> index 6f23bbe96e..fcbcc613a6 100644
> --- a/package/system/rpcd/Makefile
> +++ b/package/system/rpcd/Makefile
> @@ -8,7 +8,7 @@
>  include $(TOPDIR)/rules.mk
>  
>  PKG_NAME:=rpcd
> -PKG_RELEASE:=1
> +PKG_RELEASE:=2
>  
>  PKG_SOURCE_PROTO:=git
>  PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
> diff --git a/package/system/rpcd/files/rpcd.init b/package/system/rpcd/files/rpcd.init
> index 447133c67a..3e9ea5bbf3 100755
> --- a/package/system/rpcd/files/rpcd.init
> +++ b/package/system/rpcd/files/rpcd.init
> @@ -12,6 +12,7 @@ start_service() {
>  
>  	procd_open_instance
>  	procd_set_param command "$PROG" ${socket:+-s "$socket"} ${timeout:+-t "$timeout"}
> +	procd_set_param respawn ${respawn_retry:-0}

Why do you set the respawn_retry to 0 by default?

>  	procd_close_instance
>  }
>  
>
Thomas Richard via openwrt-devel Nov. 9, 2019, 1:46 p.m. UTC | #2
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
Hauke Mehrtens <hauke@hauke-m.de> schrieb am Sa., 9. Nov. 2019, 13:53:

> On 11/7/19 2:31 PM, Florian Eckert wrote:
> > The rpcd service is an important service, but if the service stops
> > working for any reason, no one will ever respawn that service. With this
> > commit, the procd service will monitor if the rpcd service
> > is running. If the rpcd service has crashed, then
> > procd respawns the rpcd service.
> >
> > Signed-off-by: Florian Eckert <fe@dev.tdt.de>
> > ---
> >  package/system/rpcd/Makefile        | 2 +-
> >  package/system/rpcd/files/rpcd.init | 1 +
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
> > index 6f23bbe96e..fcbcc613a6 100644
> > --- a/package/system/rpcd/Makefile
> > +++ b/package/system/rpcd/Makefile
> > @@ -8,7 +8,7 @@
> >  include $(TOPDIR)/rules.mk
> >
> >  PKG_NAME:=rpcd
> > -PKG_RELEASE:=1
> > +PKG_RELEASE:=2
> >
> >  PKG_SOURCE_PROTO:=git
> >  PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
> > diff --git a/package/system/rpcd/files/rpcd.init
> b/package/system/rpcd/files/rpcd.init
> > index 447133c67a..3e9ea5bbf3 100755
> > --- a/package/system/rpcd/files/rpcd.init
> > +++ b/package/system/rpcd/files/rpcd.init
> > @@ -12,6 +12,7 @@ start_service() {
> >
> >       procd_open_instance
> >       procd_set_param command "$PROG" ${socket:+-s "$socket"}
> ${timeout:+-t "$timeout"}
> > +     procd_set_param respawn ${respawn_retry:-0}
>
> Why do you set the respawn_retry to 0 by default?
>

As suggested by others on the mailinglist. Settings this option to 0 means
respawn forever.
Michael Jones Nov. 11, 2019, 7:20 p.m. UTC | #3
On Sat, Nov 9, 2019 at 6:53 AM Hauke Mehrtens <hauke@hauke-m.de> wrote:

> On 11/7/19 2:31 PM, Florian Eckert wrote:
> > The rpcd service is an important service, but if the service stops
> > working for any reason, no one will ever respawn that service. With this
> > commit, the procd service will monitor if the rpcd service
> > is running. If the rpcd service has crashed, then
> > procd respawns the rpcd service.
> >
> > Signed-off-by: Florian Eckert <fe@dev.tdt.de>
> > ---
> >  package/system/rpcd/Makefile        | 2 +-
> >  package/system/rpcd/files/rpcd.init | 1 +
> >  2 files changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
> > index 6f23bbe96e..fcbcc613a6 100644
> > --- a/package/system/rpcd/Makefile
> > +++ b/package/system/rpcd/Makefile
> > @@ -8,7 +8,7 @@
> >  include $(TOPDIR)/rules.mk
> >
> >  PKG_NAME:=rpcd
> > -PKG_RELEASE:=1
> > +PKG_RELEASE:=2
> >
> >  PKG_SOURCE_PROTO:=git
> >  PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
> > diff --git a/package/system/rpcd/files/rpcd.init
> b/package/system/rpcd/files/rpcd.init
> > index 447133c67a..3e9ea5bbf3 100755
> > --- a/package/system/rpcd/files/rpcd.init
> > +++ b/package/system/rpcd/files/rpcd.init
> > @@ -12,6 +12,7 @@ start_service() {
> >
> >       procd_open_instance
> >       procd_set_param command "$PROG" ${socket:+-s "$socket"}
> ${timeout:+-t "$timeout"}
> > +     procd_set_param respawn ${respawn_retry:-0}
>
> Why do you set the respawn_retry to 0 by default?
>
> >       procd_close_instance
> >  }
> >
>

(Resending to include the list itself. Apologies if anyone receives a
duplicate.)

How would procd determine that rpcd is stuck, instead of crashed?

Is there support for some kind of heartbeating behavior, similar to what
systemd offers?

One would imagine that procd's close integration with ubus would allow for
this functionality to exist without a lot of additional code.

http://0pointer.de/blog/projects/watchdog.html
> This service will automatically be restarted if it hasn't pinged the
system manager for longer than 30s or if it fails otherwise. If it is
restarted this way more often than 4 times in 5min action is taken and the
system quickly rebooted, with all file systems being clean when it comes up
again.
diff mbox series

Patch

diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
index 6f23bbe96e..fcbcc613a6 100644
--- a/package/system/rpcd/Makefile
+++ b/package/system/rpcd/Makefile
@@ -8,7 +8,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=rpcd
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
diff --git a/package/system/rpcd/files/rpcd.init b/package/system/rpcd/files/rpcd.init
index 447133c67a..3e9ea5bbf3 100755
--- a/package/system/rpcd/files/rpcd.init
+++ b/package/system/rpcd/files/rpcd.init
@@ -12,6 +12,7 @@  start_service() {
 
 	procd_open_instance
 	procd_set_param command "$PROG" ${socket:+-s "$socket"} ${timeout:+-t "$timeout"}
+	procd_set_param respawn ${respawn_retry:-0}
 	procd_close_instance
 }