From 215dfb95cbe90767df9740aa80174b9d0e23921b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Mon, 19 Apr 2021 22:18:40 -0700 Subject: [PATCH] fix(swingset): when a static vat dies, tolerate lack of next-of-kin `vatTerminated()` was choking during test-syscall-failure.js, because it want to find a Promise to resolve/reject, and static vats don't have a creator waiting to be notified about their death. This replaces the ugly internal error with a simple warning. The death of a static vat means something has gone seriously wrong, and we should consider halting the kernel, but this internal error was not the right way to display it. --- packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js b/packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js index 55a5c980461..caf5bc9e6e1 100644 --- a/packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js +++ b/packages/SwingSet/src/kernel/vatAdmin/vatAdminWrapper.js @@ -68,6 +68,13 @@ export function buildRootObject(vatPowers) { // the kernel sends this when the vat halts function vatTerminated(vatID, shouldReject, info) { + if (!running.has(vatID)) { + // a static vat terminated, so we have nobody to notify + console.log(`DANGER: static vat ${vatID} terminated`); + // TODO: consider halting the kernel if this happens, static vats + // aren't supposed to just keel over and die + return; + } const { resolve, reject } = running.get(vatID); running.delete(vatID); if (shouldReject) {