@agoric/swingset-vat 0.32.3-dev-47470c7.0 → 0.32.3-dev-de9b2e7.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 +11 -11
- package/src/controller/controller.js +50 -26
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-de9b2e7.0+de9b2e7",
|
|
4
4
|
"description": "Vat/Container Launcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -27,15 +27,15 @@
|
|
|
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-lockdown": "0.14.1-dev-
|
|
30
|
+
"@agoric/internal": "0.3.3-dev-de9b2e7.0+de9b2e7",
|
|
31
|
+
"@agoric/kmarshal": "0.1.1-dev-de9b2e7.0+de9b2e7",
|
|
32
|
+
"@agoric/store": "0.9.3-dev-de9b2e7.0+de9b2e7",
|
|
33
|
+
"@agoric/swing-store": "0.9.2-dev-de9b2e7.0+de9b2e7",
|
|
34
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-de9b2e7.0+de9b2e7",
|
|
35
|
+
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-de9b2e7.0+de9b2e7",
|
|
36
|
+
"@agoric/time": "0.3.3-dev-de9b2e7.0+de9b2e7",
|
|
37
|
+
"@agoric/vat-data": "0.5.3-dev-de9b2e7.0+de9b2e7",
|
|
38
|
+
"@agoric/xsnap-lockdown": "0.14.1-dev-de9b2e7.0+de9b2e7",
|
|
39
39
|
"@endo/base64": "^1.0.9",
|
|
40
40
|
"@endo/bundle-source": "^3.5.1",
|
|
41
41
|
"@endo/captp": "^4.4.4",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"typeCoverage": {
|
|
103
103
|
"atLeast": 76.25
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "de9b2e7ca244a6d131f2e4206aeee76f814382e4"
|
|
106
106
|
}
|
|
@@ -38,6 +38,7 @@ import { makeStartSubprocessWorkerNode } from './startNodeSubprocess.js';
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* @import {EReturn} from '@endo/far';
|
|
41
|
+
* @import {LimitedConsole} from '@agoric/internal';
|
|
41
42
|
* @import {VatID} from '../types-internal.js';
|
|
42
43
|
*/
|
|
43
44
|
|
|
@@ -89,6 +90,21 @@ function makeConsole(prefixer) {
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
/**
|
|
94
|
+
* A console-like object for logging. It starts as the global console but is
|
|
95
|
+
* immediately replaced with an anylogger instance dedicated to this file, and
|
|
96
|
+
* upon creation of a controller is replaced again with an anylogger dedicated
|
|
97
|
+
* to that controller (and which also emits slog entries).
|
|
98
|
+
*
|
|
99
|
+
* @type {LimitedConsole}
|
|
100
|
+
*/
|
|
101
|
+
let sloggingConsole = console;
|
|
102
|
+
/** @type {(newConsole: LimitedConsole) => void} */
|
|
103
|
+
const setSloggingConsole = newConsole => {
|
|
104
|
+
sloggingConsole = newConsole;
|
|
105
|
+
};
|
|
106
|
+
setSloggingConsole(makeConsole('SwingSet:controller'));
|
|
107
|
+
|
|
92
108
|
/**
|
|
93
109
|
* @param {unknown} e
|
|
94
110
|
* @param {Promise} pr
|
|
@@ -96,7 +112,7 @@ function makeConsole(prefixer) {
|
|
|
96
112
|
function onUnhandledRejection(e, pr) {
|
|
97
113
|
// Don't trigger sensitive hosts (like AVA).
|
|
98
114
|
pr.catch(() => {});
|
|
99
|
-
|
|
115
|
+
sloggingConsole.error('🤞 UnhandledPromiseRejection:', e);
|
|
100
116
|
}
|
|
101
117
|
|
|
102
118
|
/**
|
|
@@ -151,23 +167,6 @@ export async function makeSwingsetController(
|
|
|
151
167
|
throw Error('SES must be installed before calling makeSwingsetController');
|
|
152
168
|
}
|
|
153
169
|
|
|
154
|
-
const startXSnap = makeStartXSnap({
|
|
155
|
-
bundleHandler,
|
|
156
|
-
snapStore: kernelStorage.snapStore,
|
|
157
|
-
spawn,
|
|
158
|
-
fs,
|
|
159
|
-
tmpName,
|
|
160
|
-
debug: !!env.XSNAP_DEBUG,
|
|
161
|
-
workerTraceRootPath: env.XSNAP_TEST_RECORD,
|
|
162
|
-
profileVats,
|
|
163
|
-
debugVats,
|
|
164
|
-
});
|
|
165
|
-
const startSubprocessWorkerNode = makeStartSubprocessWorkerNode(
|
|
166
|
-
startSubprocessWorker,
|
|
167
|
-
profileVats,
|
|
168
|
-
debugVats,
|
|
169
|
-
);
|
|
170
|
-
|
|
171
170
|
/** @type {(obj: SlogProps) => void} */
|
|
172
171
|
function writeSlogObject(obj) {
|
|
173
172
|
if (!slogSender) return;
|
|
@@ -184,6 +183,7 @@ export async function makeSwingsetController(
|
|
|
184
183
|
// rearrange the fields a bit to make it more legible to humans
|
|
185
184
|
slogSender(harden({ type, ...props, ...timings }));
|
|
186
185
|
}
|
|
186
|
+
|
|
187
187
|
/**
|
|
188
188
|
* Capture an extended process in the slog, writing an entry with `type`
|
|
189
189
|
* $startLabel and then later (if the function returns successfully or calls
|
|
@@ -204,7 +204,8 @@ export async function makeSwingsetController(
|
|
|
204
204
|
const [startLabel, endLabel] = labels;
|
|
205
205
|
const props = { ...startProps };
|
|
206
206
|
if (hasOwn(props, 'type') || hasOwn(props, 'seconds')) {
|
|
207
|
-
|
|
207
|
+
const msg = 'startProps must not include "type" or "seconds"';
|
|
208
|
+
sloggingConsole.error(Error(msg));
|
|
208
209
|
delete props.type;
|
|
209
210
|
delete props.seconds;
|
|
210
211
|
}
|
|
@@ -216,8 +217,7 @@ export async function makeSwingsetController(
|
|
|
216
217
|
// `finish` should only be called once.
|
|
217
218
|
// Log a stack-bearing error instance, but throw something more opaque.
|
|
218
219
|
const msg = `slog event ${startLabel} ${q(startProps || {})} already finished; ignoring props ${q(extraProps || {})}`;
|
|
219
|
-
|
|
220
|
-
console.error(err);
|
|
220
|
+
sloggingConsole.error(Error(msg));
|
|
221
221
|
Fail`slog event ${startLabel} already finished`;
|
|
222
222
|
}
|
|
223
223
|
finished = true;
|
|
@@ -225,9 +225,8 @@ export async function makeSwingsetController(
|
|
|
225
225
|
// Preserve extraProps as an atomic unit by deleting prior occurrences.
|
|
226
226
|
for (const name of Object.keys(extraProps)) delete props[name];
|
|
227
227
|
if (hasOwn(extraProps, 'type') || hasOwn(extraProps, 'seconds')) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
);
|
|
228
|
+
const msg = `extraProps ${q(extraProps)} must not include "type" or "seconds"`;
|
|
229
|
+
sloggingConsole.error(Error(msg));
|
|
231
230
|
const {
|
|
232
231
|
type: _ignoredType,
|
|
233
232
|
seconds: _ignoredSeconds,
|
|
@@ -250,13 +249,38 @@ export async function makeSwingsetController(
|
|
|
250
249
|
} catch (cause) {
|
|
251
250
|
if (!finished) {
|
|
252
251
|
const msg = `unfinished slog event ${startLabel} ${q(startProps || {})}`;
|
|
253
|
-
|
|
254
|
-
console.error(err);
|
|
252
|
+
sloggingConsole.error(Error(msg, { cause }));
|
|
255
253
|
}
|
|
256
254
|
throw cause;
|
|
257
255
|
}
|
|
258
256
|
};
|
|
259
257
|
|
|
258
|
+
const controllerConsole = makeConsole(`${debugPrefix}SwingSet:controller`);
|
|
259
|
+
const controllerSloggingConsole = makeLimitedConsole(level => {
|
|
260
|
+
return (...args) => {
|
|
261
|
+
controllerConsole[level](...args);
|
|
262
|
+
writeSlogObject({ type: 'console', source: 'controller', level, args });
|
|
263
|
+
};
|
|
264
|
+
});
|
|
265
|
+
setSloggingConsole(controllerSloggingConsole);
|
|
266
|
+
|
|
267
|
+
const startXSnap = makeStartXSnap({
|
|
268
|
+
bundleHandler,
|
|
269
|
+
snapStore: kernelStorage.snapStore,
|
|
270
|
+
spawn,
|
|
271
|
+
fs,
|
|
272
|
+
tmpName,
|
|
273
|
+
debug: !!env.XSNAP_DEBUG,
|
|
274
|
+
workerTraceRootPath: env.XSNAP_TEST_RECORD,
|
|
275
|
+
profileVats,
|
|
276
|
+
debugVats,
|
|
277
|
+
});
|
|
278
|
+
const startSubprocessWorkerNode = makeStartSubprocessWorkerNode(
|
|
279
|
+
startSubprocessWorker,
|
|
280
|
+
profileVats,
|
|
281
|
+
debugVats,
|
|
282
|
+
);
|
|
283
|
+
|
|
260
284
|
const kernelInitLabels = /** @type {const} */ ([
|
|
261
285
|
'kernel-init-start',
|
|
262
286
|
'kernel-init-finish',
|