From dd31873700ed98a4a556b2574fe5092c92912fed Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Mon, 26 Apr 2021 11:22:28 +1200 Subject: [PATCH] free zombie processes from proctable --- api/src/job.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/src/job.js b/api/src/job.js index 1ee936a..c1e11d5 100644 --- a/api/src/job.js +++ b/api/src/job.js @@ -6,6 +6,7 @@ const config = require('./config'); const globals = require('./globals'); const fs = require('fs/promises'); const ps_list = require('ps-list'); +const wait_pid = require('waitpid'); const job_states = { READY: Symbol('Ready to be primed'), @@ -190,7 +191,10 @@ class Job { await Promise.all( processes.map( - proc => process.kill(proc.pid, 'SIGKILL') + async proc => { + process.kill(proc.pid, 'SIGKILL'); + wait_pid(proc.pid); //Free zombie state process + } ) );