You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
procd loses respawn parameters when using /etc/init.d//restart
This happens when the program takes too long time to stop.
Here is the reason why:
in instance.c, the respawn and restart bools are set to false.
//instance.c
void
instance_stop(struct service_instance *in, bool halt)
{
...
in->restart = in->respawn = false; => restart and respawn bool set to false
kill(in->proc.pid, SIGTERM);
...
}
in service_handle_set (called for starting the process anew), we have the following code:
s = avl_find_element(&services, name, s, avl);
if (s) {
DEBUG(2, "Update service %s\n", name);
return service_update(s, tb, add); => we are here, because the program didn't yet terminate ! avl_find_element doesn't return NULL
}
DEBUG(2, "Create service %s\n", name);
s = service_alloc(name);
if (!s)
return UBUS_STATUS_UNKNOWN_ERROR;
ret = service_update(s, tb, add);</code>
In my case, avl_find_element returns the previous instance because the program didn't close yet. service_update is called on the previous structure, without allocating a new one.
problem: in->restart and in->respawn are still false !
consequence: "respawn" parameters are lost. This is visible in the output of ubus call service list '{"name":"program"}'
example:
before /etc/init.d/program/restart : "program": {
"instances": {
"program": {
"running": true,
"pid": 4904,
"command": [
"/usr/bin/program",
],
"term_timeout": 5,
"limits": {
"core": "unlimited"
},
"respawn": {
"threshold": 3600,
"timeout": 1,
"retry": 0
},
"pidfile": "/var/run/program.pid"
}
}
},
after "program": {
"instances": {
"program": {
"running": true,
"pid": 4904,
"command": [
"/usr/bin/program",
],
"term_timeout": 5,
"limits": {
"core": "unlimited"
},
"pidfile": "/var/run/program.pid"
}
}
},
The text was updated successfully, but these errors were encountered:
antismap:
procd loses respawn parameters when using /etc/init.d//restart
This happens when the program takes too long time to stop.
Here is the reason why:
//instance.c void instance_stop(struct service_instance *in, bool halt) { ... in->restart = in->respawn = false; => restart and respawn bool set to false kill(in->proc.pid, SIGTERM); ... }
s = avl_find_element(&services, name, s, avl);
if (s) {
DEBUG(2, "Update service %s\n", name);
return service_update(s, tb, add); => we are here, because the program didn't yet terminate ! avl_find_element doesn't return NULL
}
In my case, avl_find_element returns the previous instance because the program didn't close yet. service_update is called on the previous structure, without allocating a new one.
problem: in->restart and in->respawn are still false !
consequence: "respawn" parameters are lost. This is visible in the output of
ubus call service list '{"name":"program"}'
example:
before /etc/init.d/program/restart :
"program": {
"instances": {
"program": {
"running": true,
"pid": 4904,
"command": [
"/usr/bin/program",
],
"term_timeout": 5,
"limits": {
"core": "unlimited"
},
"respawn": {
"threshold": 3600,
"timeout": 1,
"retry": 0
},
"pidfile": "/var/run/program.pid"
}
}
},
after
"program": {
"instances": {
"program": {
"running": true,
"pid": 4904,
"command": [
"/usr/bin/program",
],
"term_timeout": 5,
"limits": {
"core": "unlimited"
},
"pidfile": "/var/run/program.pid"
}
}
},
The text was updated successfully, but these errors were encountered: