tasks: fix update failed notification
https://forum.cloudron.io/topic/13408/update-to-cloudron-8.3-error We get a Task xx crashed with code null in the notification. The crux of the issue is that we use KillMode=control-group. This ends up sending SIGTERM signal to box code and all the sudo in parallel. The box code then sees the sudo die and records the task as failed. To fix, we switch to KillMode=mixed. This gives box code a chance to handle SIGTERM first. It cleans out its task list and kills all the sudo.
This commit is contained in:
+3
-2
@@ -234,9 +234,10 @@ async function stopTask(id) {
|
||||
}
|
||||
|
||||
async function stopAllTasks() {
|
||||
debug('stopAllTasks: stopping all tasks');
|
||||
|
||||
debug('stopAllTasks: ignoring exit status of starttask');
|
||||
const cps = Object.values(gTasks);
|
||||
gTasks = {}; // this signals startTask() to not set completion status as "crashed"
|
||||
cps.forEach(cp => { debug(`stopAllTasks: terminating process group ${cp.pid}`); cp.terminate(); }); // cleanup all the sudos and systemd-run
|
||||
const [error] = await safe(shell.promises.sudo([ STOP_TASK_CMD, 'all' ], { cwd: paths.baseDir() }));
|
||||
if (error) debug(`stopAllTasks: error stopping stasks: ${error.message}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user