From c2a8683c53c9d5782cfb1f67794f3aaaadbd2ce7 Mon Sep 17 00:00:00 2001 From: KhalilBellakrid Date: Wed, 15 Aug 2018 17:35:33 +0200 Subject: [PATCH] Avoid stack overflow when calling execute method of NJSExecutionContext --- src/helpers/init-libcore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/helpers/init-libcore.js b/src/helpers/init-libcore.js index c7bd4213..5f9ee7cb 100644 --- a/src/helpers/init-libcore.js +++ b/src/helpers/init-libcore.js @@ -24,7 +24,8 @@ const stringToBytesArray = str => Array.from(Buffer.from(str)) const NJSExecutionContextImpl = { execute: runnable => { try { - runnable.run() + const runFunction = () => runnable.run() + setImmediate(runFunction) } catch (e) { logger.log(e) }