@agoric/swingset-vat 0.32.3-dev-bf1e645.0 → 0.32.3-dev-07f6885.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/swingset-vat",
|
|
3
|
-
"version": "0.32.3-dev-
|
|
3
|
+
"version": "0.32.3-dev-07f6885.0+07f6885",
|
|
4
4
|
"description": "Vat/Container Launcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
"@types/yargs-parser": "^21.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@agoric/internal": "0.3.3-dev-
|
|
31
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
32
|
-
"@agoric/store": "0.9.3-dev-
|
|
33
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
34
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
35
|
-
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-
|
|
36
|
-
"@agoric/time": "0.3.3-dev-
|
|
37
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
38
|
-
"@agoric/xsnap": "0.14.3-dev-
|
|
39
|
-
"@agoric/xsnap-lockdown": "0.14.1-dev-
|
|
30
|
+
"@agoric/internal": "0.3.3-dev-07f6885.0+07f6885",
|
|
31
|
+
"@agoric/kmarshal": "0.1.1-dev-07f6885.0+07f6885",
|
|
32
|
+
"@agoric/store": "0.9.3-dev-07f6885.0+07f6885",
|
|
33
|
+
"@agoric/swing-store": "0.9.2-dev-07f6885.0+07f6885",
|
|
34
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-07f6885.0+07f6885",
|
|
35
|
+
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-07f6885.0+07f6885",
|
|
36
|
+
"@agoric/time": "0.3.3-dev-07f6885.0+07f6885",
|
|
37
|
+
"@agoric/vat-data": "0.5.3-dev-07f6885.0+07f6885",
|
|
38
|
+
"@agoric/xsnap": "0.14.3-dev-07f6885.0+07f6885",
|
|
39
|
+
"@agoric/xsnap-lockdown": "0.14.1-dev-07f6885.0+07f6885",
|
|
40
40
|
"@endo/base64": "^1.0.7",
|
|
41
41
|
"@endo/bundle-source": "^3.4.0",
|
|
42
42
|
"@endo/captp": "^4.3.0",
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"typeCoverage": {
|
|
104
104
|
"atLeast": 75.7
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "07f6885c560333981d6564581b2a00735a6c428c"
|
|
107
107
|
}
|
package/src/kernel/kernel.js
CHANGED
|
@@ -4,7 +4,7 @@ import { assert, Fail } from '@endo/errors';
|
|
|
4
4
|
import { isNat } from '@endo/nat';
|
|
5
5
|
import { mustMatch, M } from '@endo/patterns';
|
|
6
6
|
import { importBundle } from '@endo/import-bundle';
|
|
7
|
-
import { objectMetaMap } from '@agoric/internal';
|
|
7
|
+
import { objectMetaMap, PromiseAllOrErrors } from '@agoric/internal';
|
|
8
8
|
import { makeUpgradeDisconnection } from '@agoric/internal/src/upgrade-api.js';
|
|
9
9
|
import { kser, kslot, makeError } from '@agoric/kmarshal';
|
|
10
10
|
import { assertKnownOptions } from '../lib/assertOptions.js';
|
|
@@ -261,8 +261,12 @@ export default function buildKernel(
|
|
|
261
261
|
*/
|
|
262
262
|
async function terminateVat(vatID, shouldReject, info) {
|
|
263
263
|
console.log(`kernel terminating vat ${vatID} (failure=${shouldReject})`);
|
|
264
|
-
let critical = false;
|
|
265
264
|
insistCapData(info);
|
|
265
|
+
// Note that it's important for much of this work to happen within the
|
|
266
|
+
// synchronous prelude. For details, see
|
|
267
|
+
// https://github.com/Agoric/agoric-sdk/pull/10055#discussion_r1754918394
|
|
268
|
+
let critical = false;
|
|
269
|
+
const deferred = [];
|
|
266
270
|
// ISSUE: terminate stuff in its own crank like creation?
|
|
267
271
|
// TODO: if a static vat terminates, panic the kernel?
|
|
268
272
|
// TODO: guard against somebody telling vatAdmin to kill a vat twice
|
|
@@ -287,7 +291,7 @@ export default function buildKernel(
|
|
|
287
291
|
// remove vatID from the list of live vats, and mark for deletion
|
|
288
292
|
kernelKeeper.deleteVatID(vatID);
|
|
289
293
|
kernelKeeper.markVatAsTerminated(vatID);
|
|
290
|
-
kernelKeeper.removeVatFromSwingStoreExports(vatID);
|
|
294
|
+
deferred.push(kernelKeeper.removeVatFromSwingStoreExports(vatID));
|
|
291
295
|
for (const kpid of deadPromises) {
|
|
292
296
|
resolveToError(kpid, makeError('vat terminated'), vatID);
|
|
293
297
|
}
|
|
@@ -302,9 +306,7 @@ export default function buildKernel(
|
|
|
302
306
|
// it's going to be a small cost compared to the trouble you're probably
|
|
303
307
|
// already in anyway if this happens.
|
|
304
308
|
panic(`critical vat ${vatID} failed`, Error(info.body));
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
if (vatAdminRootKref) {
|
|
309
|
+
} else if (vatAdminRootKref) {
|
|
308
310
|
// static vat termination can happen before vat admin vat exists
|
|
309
311
|
notifyTermination(
|
|
310
312
|
vatID,
|
|
@@ -319,8 +321,11 @@ export default function buildKernel(
|
|
|
319
321
|
);
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
// worker needs to be stopped
|
|
323
|
-
|
|
324
|
+
// worker, if present, needs to be stopped
|
|
325
|
+
// (note that this only applies to ephemeral vats)
|
|
326
|
+
deferred.push(vatWarehouse.stopWorker(vatID));
|
|
327
|
+
|
|
328
|
+
await PromiseAllOrErrors(deferred);
|
|
324
329
|
}
|
|
325
330
|
|
|
326
331
|
function notifyMeterThreshold(meterID) {
|
|
@@ -930,13 +930,13 @@ export default function makeKernelKeeper(
|
|
|
930
930
|
kvStore.set(`${kernelSlot}.data.slots`, capdata.slots.join(','));
|
|
931
931
|
}
|
|
932
932
|
|
|
933
|
-
function removeVatFromSwingStoreExports(vatID) {
|
|
933
|
+
async function removeVatFromSwingStoreExports(vatID) {
|
|
934
934
|
// Delete primary swingstore records for this vat, in preparation
|
|
935
935
|
// for (slow) deletion. After this, swingstore exports will omit
|
|
936
936
|
// this vat. This is called from the kernel's terminateVat, which
|
|
937
937
|
// initiates (but does not complete) deletion.
|
|
938
938
|
snapStore.stopUsingLastSnapshot(vatID);
|
|
939
|
-
transcriptStore.stopUsingTranscript(vatID);
|
|
939
|
+
await transcriptStore.stopUsingTranscript(vatID);
|
|
940
940
|
}
|
|
941
941
|
|
|
942
942
|
/**
|
|
@@ -655,7 +655,7 @@ export function makeVatKeeper(
|
|
|
655
655
|
addToTranscript(makeSaveSnapshotItem(snapshotID));
|
|
656
656
|
|
|
657
657
|
// then start a new transcript span
|
|
658
|
-
transcriptStore.rolloverSpan(vatID);
|
|
658
|
+
await transcriptStore.rolloverSpan(vatID);
|
|
659
659
|
|
|
660
660
|
// then push a load-snapshot entry, so that the current span
|
|
661
661
|
// always starts with an initialize-worker or load-snapshot
|
|
@@ -715,7 +715,7 @@ export function makeVatKeeper(
|
|
|
715
715
|
return transcriptStore.deleteVatTranscripts(vatID, budget);
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
-
function beginNewIncarnation() {
|
|
718
|
+
async function beginNewIncarnation() {
|
|
719
719
|
if (snapStore) {
|
|
720
720
|
snapStore.stopUsingLastSnapshot(vatID);
|
|
721
721
|
}
|
|
@@ -94,6 +94,9 @@ export function makeVatAdminHooks(tools) {
|
|
|
94
94
|
// we don't need to incrementRefCount because if terminateVat sends
|
|
95
95
|
// 'reason' to vat-admin, it uses notifyTermination / queueToKref /
|
|
96
96
|
// doSend, and doSend() does its own incref
|
|
97
|
+
// FIXME: This assumes that most work of terminateVat happens in the
|
|
98
|
+
// synchronous prelude, which should be made more obvious. For details,
|
|
99
|
+
// see https://github.com/Agoric/agoric-sdk/pull/10055#discussion_r1754918394
|
|
97
100
|
void terminateVat(vatID, true, marshalledReason);
|
|
98
101
|
// TODO: terminateVat is async, result doesn't fire until worker
|
|
99
102
|
// is dead. To fix this we'll probably need to move termination
|