Right now, init has a single backoff clock. I would rather each process has its own.
- When a process starts, we set a deadline for the process, as
now + nap.
- If a process dies before its deadline, double
nap, up to 6,400 ms.
- If a deadline passes and a process is not running, start it and go to (1).
- If a deadline passes and a process is running, halve its
nap, down to 100ms, and set a new deadline.
This should cause the backoff algorithm to "back back on" and allow a process that dies after hours to be restarted almost immediately, rather than continually delay and delay because of a perfect memory of previous failures.
(Note: this either means that we sleep in a single supervisor thread for min(what's left on deadlines), or we spin up a process per supervised process. If we opt for the latter, I'd really like to change the names of the processes to something like "init--", making it trivial to SIGHUP a single supervised process. Also, we should probably "relay" some signals to child processes.)
Right now,
inithas a single backoff clock. I would rather each process has its own.now + nap.nap, up to 6,400 ms.nap, down to 100ms, and set a new deadline.This should cause the backoff algorithm to "back back on" and allow a process that dies after hours to be restarted almost immediately, rather than continually delay and delay because of a perfect memory of previous failures.
(Note: this either means that we sleep in a single supervisor thread for
min(what's left on deadlines), or we spin up a process per supervised process. If we opt for the latter, I'd really like to change the names of the processes to something like "init--", making it trivial to SIGHUP a single supervised process. Also, we should probably "relay" some signals to child processes.)