diff mbox series

[LEDE-DEV,1/2] procd: Fix respawn after restart of instance

Message ID 20180322170123.22269-1-pavel.merzlyakov@gmail.com
State New
Headers show
Series [LEDE-DEV,1/2] procd: Fix respawn after restart of instance | expand

Commit Message

Pavel Merzlyakov March 22, 2018, 5:01 p.m. UTC
Without this fix respawn will be turned off
in case when we (async) stop instance
and then start it again while it not actually killed.

Signed-off-by: Pavel Merzlyakov <pavel.merzlyakov@gmail.com>
 service/instance.c | 1 +
 1 file changed, 1 insertion(+)


Pavel Merzlyakov March 23, 2018, 11:55 a.m. UTC | #1
Miss this patch -> "[LEDE-DEV] [PATCH] procd: Restore respawn on
SIGTERM timeout"
It's try to solve same problem.

Description seems to be misleading (patch also seems to be wrong):
>When SIGTERM times out, procd sends SIGKILL and then restarts the
>process once SIGCHLD has been received. This all works fine, with one
>exception - respawn is not restored when instance_start() is called from
>instance_exit(). The reason is that respawn is always set to false in
>instance_stop(), and the same service_instance struct is used for the

Because respawn is not restored when instance_start() is called from
instance_update() (not from instance_exit()).
In order to reproduce problem we should call instance_start() before

If we call instance_stop() it set in->restart to false and
instance_start() will never be called from instance_exit().
diff mbox series


diff --git a/service/instance.c b/service/instance.c
index ecbb6ea..5a14f82 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -944,6 +944,7 @@  instance_config_move(struct service_instance *in, struct service_instance *in_sr
 	in->trigger = in_src->trigger;
 	in->command = in_src->command;
 	in->pidfile = in_src->pidfile;
+	in->respawn = in_src->respawn;
 	in->respawn_retry = in_src->respawn_retry;
 	in->respawn_threshold = in_src->respawn_threshold;
 	in->respawn_timeout = in_src->respawn_timeout;