diff --git a/src/services/javascriptSandbox.js b/src/services/javascriptSandbox.js index ad4d443..aac2e16 100644 --- a/src/services/javascriptSandbox.js +++ b/src/services/javascriptSandbox.js @@ -144,6 +144,12 @@ function spawnWorker(vfsRoot, googleAuthId) { return; } + // Permanent listener: without it an error emitted while the thread is idle (no job + // listener attached) is unhandled and takes down the whole process. + entry.worker.on('error', (err) => { + console.error('[sandbox] worker error:', err?.message || err); + dropWorker(entry); + }); entry.worker.on('message', onBooted); entry.worker.on('error', onError); entry.worker.on('exit', onExit);