[LEDE-DEV] [PATCH] procd: Restore respawn on SIGTERM timeout

Kristian Evensen kristian.evensen at gmail.com
Tue Nov 28 11:17:36 PST 2017


Hi Karl,

Sorry for my extremely late reply. For some reason, it was not picked
up by Gmail and I did not see it before today. Since it was not picked
up by Gmail, I had to do some creative c&p, sorry in advance for weird
formatting.

>>Kristian Evensen <kristian.evensen at gmail.com> wrote:
>> 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
>> instance_start()-call.
>>
>> The consequence is that if the process is killed/crashes again,
>> it will not respawn. Solve this issue by adding a variable used
>> to store the original value of respawn in instance_stop(), and
>> then restore the original respawn-value in instance_exit().
>
> It smells like this likely applies to many other fields. Is there
> a path here that's not using the copy/compare routines for a
> service/instance? Should they be? Does your path even restore all
> the parameters of respawn?

As far as I can tell (and based on my tests), only in->respawn is
overwritten and not recovered. All other fields keep their value. The
rc.local restart-operation seems to be a stop() and then a
start()-call, so in->restart is correctly set to false.

BR,
Kristian



More information about the Lede-dev mailing list