From ebcb6b2ab080068c89d895ea9b27c9fe52ed7510 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 3 Feb 2022 15:11:26 +0530 Subject: [PATCH] log child process ids in the event of an RPC timeout --- lib/workers/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/workers/index.js b/lib/workers/index.js index c2bfb5740..d70b490e3 100644 --- a/lib/workers/index.js +++ b/lib/workers/index.js @@ -139,6 +139,9 @@ Workers.initialize = function (Env, config, _cb) { msg.txid = txid; msg.pid = PID; + // include the relevant worker process id in messages so that it will be logged + // in the event that the message times out or fails in other ways. + msg.worker = state.pid; // track which worker is doing which jobs state.tasks[txid] = msg; @@ -201,6 +204,7 @@ Workers.initialize = function (Env, config, _cb) { const state = { worker: worker, tasks: {}, + pid: worker.pid, // store the child process's id in an easily accessible location }; response.expect(txid, function (err) {