From 32f082fab72280010d3550328546a17e60c40286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D1=81=D0=B5=D0=B2=D0=BE=D0=BB=D0=BE=D0=B4?= Date: Tue, 5 Mar 2024 20:22:26 +0300 Subject: [PATCH] Add try catch on get_stats in timeout killer --- api/src/job.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/src/job.js b/api/src/job.js index 5af355d..9709d92 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -236,9 +236,14 @@ class Job { const kill_timeout = (timeout >= 0 && set_timeout(async _ => { - this.get_stats(proc.pid).then(stat => { - stats.push(stat); - }); + try { + this.get_stats(proc.pid).then(stat => { + stats.push(stat); + }); + } catch (e) { + this.logger.debug(`Got error while getting stats:`, e); + } + this.logger.info(`Timeout exceeded timeout=${timeout}`); try { process.kill(proc.pid, 'SIGKILL');