detect oom in tasks correctly
This commit is contained in:
+3
-4
@@ -171,9 +171,8 @@ function startTask(id, options, callback) {
|
||||
if (!gTasks[id]) return; // ignore task exit since we are shutting down. see stopAllTasks
|
||||
|
||||
const code = sudoError ? sudoError.code : 0;
|
||||
const signal = sudoError ? sudoError.signal : 0;
|
||||
|
||||
debug(`startTask: ${id} completed with code ${code} and signal ${signal}`);
|
||||
debug(`startTask: ${id} completed with code ${code}`);
|
||||
|
||||
if (options.timeout) clearTimeout(killTimerId);
|
||||
|
||||
@@ -186,9 +185,9 @@ function startTask(id, options, callback) {
|
||||
message: `Task ${id} ${timedOut ? 'timed out' : 'stopped'}` ,
|
||||
code: timedOut ? exports.ETIMEOUT : exports.ESTOPPED
|
||||
};
|
||||
} else { // task crashed
|
||||
} else { // task crashed. for code, maybe we can check systemctl show box-task-1707 -p ExecMainStatus
|
||||
taskError = {
|
||||
message: signal === 9 ? `Task ${id} crashed as it ran out of memory` : `Task ${id} crashed with code ${code} and signal ${signal}`,
|
||||
message: code === 2 ? `Task ${id} crashed as it ran out of memory` : `Task ${id} crashed with code ${code}`,
|
||||
code: exports.ECRASHED
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user