From 884bbe01f088588d862b2466eaf87e879c201fad Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 21 Mar 2024 20:48:35 +0000 Subject: [PATCH] Add trace for who last started the stack --- .../node_modules/@node-red/runtime/lib/flows/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/node_modules/@node-red/runtime/lib/flows/index.js b/packages/node_modules/@node-red/runtime/lib/flows/index.js index c955dfe1c..2273e8b89 100644 --- a/packages/node_modules/@node-red/runtime/lib/flows/index.js +++ b/packages/node_modules/@node-red/runtime/lib/flows/index.js @@ -44,9 +44,11 @@ var activeNodesToFlow = {}; var typeEventRegistered = false; +let lastStarterStack + function init(runtime) { if (started) { - throw new Error("Cannot init without a stop"); + throw new Error("Cannot init without a stop:" + lastStarterStack); } settings = runtime.settings; storage = runtime.storage; @@ -274,7 +276,7 @@ async function start(type,diff,muteLog,isDeploy) { if (diff && diff.globalConfigChanged) { type = 'full' } - + lastStarterStack = new Error('Flows started here').stack started = true; state = 'start' var i; @@ -334,6 +336,7 @@ async function start(type,diff,muteLog,isDeploy) { log.info(log._("nodes.flows.stopped-flows")); events.emit("runtime-event",{id:"runtime-state",payload:{ state: 'stop', deploy:isDeploy },retain:true}); state = 'stop' + lastStarterStack = null started = false return } @@ -454,6 +457,7 @@ function stop(type,diff,muteLog,isDeploy) { if (diff.globalConfigChanged) { type = 'full' } + lastStarterStack = null started = false; state = 'stop' var promises = [];