@agoric/swingset-vat 0.32.3-dev-82cced2.0 → 0.32.3-dev-354c092.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 +13 -13
- package/src/controller/controller.js +8 -0
- package/src/controller/startNodeSubprocess.js +16 -2
- package/src/controller/startXSnap.js +12 -0
- package/src/kernel/vat-loader/manager-subprocess-node.js +5 -3
- package/src/kernel/vat-loader/manager-subprocess-xsnap.js +2 -0
- package/src/supervisors/subprocess-node/supervisor-subprocess-node.js +4 -0
- package/src/vats/timer/vat-timer.js +6 -6
- package/tools/manual-timer.js +2 -2
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-354c092.0+354c092",
|
|
4
4
|
"description": "Vat/Container Launcher",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -27,17 +27,17 @@
|
|
|
27
27
|
"@types/yargs-parser": "^21.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@agoric/assert": "0.6.1-dev-
|
|
31
|
-
"@agoric/internal": "0.3.3-dev-
|
|
32
|
-
"@agoric/kmarshal": "0.1.1-dev-
|
|
33
|
-
"@agoric/store": "0.9.3-dev-
|
|
34
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
35
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
36
|
-
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-
|
|
37
|
-
"@agoric/time": "0.3.3-dev-
|
|
38
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
39
|
-
"@agoric/xsnap": "0.14.3-dev-
|
|
40
|
-
"@agoric/xsnap-lockdown": "0.14.1-dev-
|
|
30
|
+
"@agoric/assert": "0.6.1-dev-354c092.0+354c092",
|
|
31
|
+
"@agoric/internal": "0.3.3-dev-354c092.0+354c092",
|
|
32
|
+
"@agoric/kmarshal": "0.1.1-dev-354c092.0+354c092",
|
|
33
|
+
"@agoric/store": "0.9.3-dev-354c092.0+354c092",
|
|
34
|
+
"@agoric/swing-store": "0.9.2-dev-354c092.0+354c092",
|
|
35
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-354c092.0+354c092",
|
|
36
|
+
"@agoric/swingset-xsnap-supervisor": "0.10.3-dev-354c092.0+354c092",
|
|
37
|
+
"@agoric/time": "0.3.3-dev-354c092.0+354c092",
|
|
38
|
+
"@agoric/vat-data": "0.5.3-dev-354c092.0+354c092",
|
|
39
|
+
"@agoric/xsnap": "0.14.3-dev-354c092.0+354c092",
|
|
40
|
+
"@agoric/xsnap-lockdown": "0.14.1-dev-354c092.0+354c092",
|
|
41
41
|
"@endo/base64": "^0.2.34",
|
|
42
42
|
"@endo/bundle-source": "^2.7.0",
|
|
43
43
|
"@endo/captp": "^3.1.4",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"typeCoverage": {
|
|
103
103
|
"atLeast": 75.26
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "354c09254ac91e9dc97ca97f6bef291b2cafabb6"
|
|
106
106
|
}
|
|
@@ -103,6 +103,8 @@ function unhandledRejectionHandler(e, pr) {
|
|
|
103
103
|
* kernelBundle?: Bundle
|
|
104
104
|
* xsnapBundleData?: ReturnType<import('./bundle-handler.js').makeXsnapBundleData>,
|
|
105
105
|
* bundleHandler?: import('./bundle-handler.js').BundleHandler,
|
|
106
|
+
* profileVats?: string[],
|
|
107
|
+
* debugVats?: string[],
|
|
106
108
|
* }} runtimeOptions
|
|
107
109
|
*/
|
|
108
110
|
export async function makeSwingsetController(
|
|
@@ -126,6 +128,8 @@ export async function makeSwingsetController(
|
|
|
126
128
|
warehousePolicy = {},
|
|
127
129
|
overrideVatManagerOptions = {},
|
|
128
130
|
xsnapBundleData = makeXsnapBundleData(),
|
|
131
|
+
profileVats = [],
|
|
132
|
+
debugVats = [],
|
|
129
133
|
} = runtimeOptions;
|
|
130
134
|
const {
|
|
131
135
|
bundleHandler = makeWorkerBundleHandler(
|
|
@@ -146,9 +150,13 @@ export async function makeSwingsetController(
|
|
|
146
150
|
tmpName,
|
|
147
151
|
debug: !!env.XSNAP_DEBUG,
|
|
148
152
|
workerTraceRootPath: env.XSNAP_TEST_RECORD,
|
|
153
|
+
profileVats,
|
|
154
|
+
debugVats,
|
|
149
155
|
});
|
|
150
156
|
const startSubprocessWorkerNode = makeStartSubprocessWorkerNode(
|
|
151
157
|
startSubprocessWorker,
|
|
158
|
+
profileVats,
|
|
159
|
+
debugVats,
|
|
152
160
|
);
|
|
153
161
|
|
|
154
162
|
function writeSlogObject(obj) {
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import process from 'process';
|
|
2
2
|
|
|
3
|
-
export function makeStartSubprocessWorkerNode(
|
|
3
|
+
export function makeStartSubprocessWorkerNode(
|
|
4
|
+
startSubprocessWorker,
|
|
5
|
+
profileVats,
|
|
6
|
+
debugVats,
|
|
7
|
+
) {
|
|
4
8
|
// launch a worker in a subprocess (which runs Node.js)
|
|
5
|
-
function startSubprocessWorkerNode(nameDisplayArg, nodeOptions) {
|
|
9
|
+
function startSubprocessWorkerNode(nameDisplayArg, vatID, nodeOptions) {
|
|
6
10
|
const supervisorCodePath = new URL(
|
|
7
11
|
'../supervisors/subprocess-node/supervisor-subprocess-node.js',
|
|
8
12
|
import.meta.url,
|
|
9
13
|
).pathname;
|
|
10
14
|
const args = nodeOptions ? [...nodeOptions] : [];
|
|
15
|
+
if (profileVats.includes(vatID)) {
|
|
16
|
+
args.push('--cpu-prof');
|
|
17
|
+
args.push('--cpu-prof-interval');
|
|
18
|
+
args.push('100');
|
|
19
|
+
args.push('--cpu-prof-name');
|
|
20
|
+
args.push(`CPU.${nameDisplayArg}.cpuprofile`);
|
|
21
|
+
}
|
|
22
|
+
if (debugVats.includes(vatID)) {
|
|
23
|
+
args.push('--inspect-brk');
|
|
24
|
+
}
|
|
11
25
|
args.push(supervisorCodePath);
|
|
12
26
|
args.push(nameDisplayArg);
|
|
13
27
|
return startSubprocessWorker(process.execPath, args);
|
|
@@ -41,6 +41,8 @@ const NETSTRING_MAX_CHUNK_SIZE = 12_000_000;
|
|
|
41
41
|
* debug?: boolean,
|
|
42
42
|
* workerTraceRootPath?: string,
|
|
43
43
|
* overrideBundles?: import('../types-external.js').Bundle[],
|
|
44
|
+
* profileVats?: string[],
|
|
45
|
+
* debugVats?: string[],
|
|
44
46
|
* }} options
|
|
45
47
|
*/
|
|
46
48
|
export function makeStartXSnap(options) {
|
|
@@ -54,6 +56,8 @@ export function makeStartXSnap(options) {
|
|
|
54
56
|
snapStore,
|
|
55
57
|
workerTraceRootPath,
|
|
56
58
|
overrideBundles,
|
|
59
|
+
profileVats = [],
|
|
60
|
+
debugVats = [],
|
|
57
61
|
debug = false,
|
|
58
62
|
} = options;
|
|
59
63
|
|
|
@@ -123,6 +127,7 @@ export function makeStartXSnap(options) {
|
|
|
123
127
|
* @param {string} name
|
|
124
128
|
* @param {object} details
|
|
125
129
|
* @param {import('../types-external.js').BundleID[]} details.bundleIDs
|
|
130
|
+
* @param {string} details.vatID
|
|
126
131
|
* @param {(request: Uint8Array) => Promise<Uint8Array>} details.handleCommand
|
|
127
132
|
* @param {boolean} [details.metered]
|
|
128
133
|
* @param {StartXSnapInitDetails} [details.init]
|
|
@@ -131,11 +136,18 @@ export function makeStartXSnap(options) {
|
|
|
131
136
|
name,
|
|
132
137
|
{
|
|
133
138
|
bundleIDs,
|
|
139
|
+
vatID,
|
|
134
140
|
handleCommand,
|
|
135
141
|
metered,
|
|
136
142
|
init: initDetails = { from: 'bundles' },
|
|
137
143
|
},
|
|
138
144
|
) {
|
|
145
|
+
if (profileVats.includes(vatID)) {
|
|
146
|
+
Fail`startXSnap: not yet supporting profiling for vat ${vatID}`;
|
|
147
|
+
}
|
|
148
|
+
if (debugVats.includes(vatID)) {
|
|
149
|
+
Fail`startXSnap: not yet supporting debugging for vat ${vatID}`;
|
|
150
|
+
}
|
|
139
151
|
const meterOpts = metered ? {} : { meteringLimit: 0 };
|
|
140
152
|
const snapshotLoadOpts = getSnapshotLoadOptions(initDetails);
|
|
141
153
|
await null;
|
|
@@ -30,14 +30,15 @@ export function makeNodeSubprocessFactory(tools) {
|
|
|
30
30
|
Fail`nodeOptions must be an array`;
|
|
31
31
|
|
|
32
32
|
// Node worker subprocess adds `nameDisplayArg` as a dummy argument so that
|
|
33
|
-
// 'ps'shows which worker is for which vat
|
|
33
|
+
// 'ps' shows which worker is for which vat
|
|
34
34
|
const nameDisplayArg = `${vatID}:${name !== undefined ? name : ''}`;
|
|
35
35
|
|
|
36
36
|
const mk = makeManagerKit();
|
|
37
37
|
|
|
38
38
|
// start the worker and establish a connection
|
|
39
|
-
const { fromChild, toChild,
|
|
39
|
+
const { fromChild, toChild, done } = startSubprocessWorker(
|
|
40
40
|
nameDisplayArg,
|
|
41
|
+
vatID,
|
|
41
42
|
nodeOptions,
|
|
42
43
|
);
|
|
43
44
|
|
|
@@ -107,7 +108,8 @@ export function makeNodeSubprocessFactory(tools) {
|
|
|
107
108
|
sendToWorker(['setBundle', vatID, bundle, liveSlotsOptions]);
|
|
108
109
|
|
|
109
110
|
function shutdown() {
|
|
110
|
-
terminate();
|
|
111
|
+
// terminate(); // XXX currently disabled since it breaks profiling; we should revisit if we develop a problem with worker vat processes refusing to exit when requested to do so
|
|
112
|
+
sendToWorker(['exit']);
|
|
111
113
|
return E.when(done, _ => undefined);
|
|
112
114
|
}
|
|
113
115
|
const manager = mk.getManager(shutdown);
|
|
@@ -143,6 +143,7 @@ export function makeXsSubprocessFactory({
|
|
|
143
143
|
// start the worker and establish a connection
|
|
144
144
|
let worker = await startXSnap(nameDisplayArg, {
|
|
145
145
|
bundleIDs,
|
|
146
|
+
vatID,
|
|
146
147
|
handleCommand: handleCommandKit.handleCommand,
|
|
147
148
|
metered,
|
|
148
149
|
init: snapshotInfo && { from: 'snapStore', vatID },
|
|
@@ -258,6 +259,7 @@ export function makeXsSubprocessFactory({
|
|
|
258
259
|
[worker, snapshotResults] = await Promise.all([
|
|
259
260
|
startXSnap(nameDisplayArg, {
|
|
260
261
|
bundleIDs,
|
|
262
|
+
vatID,
|
|
261
263
|
handleCommand: handleCommandKit.handleCommand,
|
|
262
264
|
metered,
|
|
263
265
|
init: {
|
|
@@ -6,6 +6,7 @@ import '@endo/init';
|
|
|
6
6
|
import anylogger from 'anylogger';
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import { Buffer } from 'buffer';
|
|
9
|
+
import process from 'node:process';
|
|
9
10
|
|
|
10
11
|
import { assert, details as X, Fail } from '@agoric/assert';
|
|
11
12
|
import { importBundle } from '@endo/import-bundle';
|
|
@@ -188,6 +189,9 @@ async function handleCommand(command) {
|
|
|
188
189
|
return handleSetBundle(margs);
|
|
189
190
|
case 'deliver':
|
|
190
191
|
return handleDeliver(margs);
|
|
192
|
+
case 'exit':
|
|
193
|
+
process.exit(0);
|
|
194
|
+
break;
|
|
191
195
|
default:
|
|
192
196
|
throw Error(`unrecognized downlink message ${type}`);
|
|
193
197
|
}
|
|
@@ -20,12 +20,12 @@ import { TimeMath } from '@agoric/time';
|
|
|
20
20
|
// client). Everything else should remain in the DB.
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* @typedef {import('@agoric/time
|
|
24
|
-
* @typedef {import('@agoric/time
|
|
25
|
-
* @typedef {import('@agoric/time
|
|
26
|
-
* @typedef {import('@agoric/time
|
|
27
|
-
* @typedef {import('@agoric/time
|
|
28
|
-
* @typedef {import('@agoric/time
|
|
23
|
+
* @typedef {import('@agoric/time').Timestamp} Timestamp
|
|
24
|
+
* @typedef {import('@agoric/time').TimestampRecord} TimestampRecord
|
|
25
|
+
* @typedef {import('@agoric/time').TimestampValue} TimestampValue
|
|
26
|
+
* @typedef {import('@agoric/time').RelativeTime} RelativeTime
|
|
27
|
+
* @typedef {import('@agoric/time').RelativeTimeValue} RelativeTimeValue
|
|
28
|
+
* @typedef {import('@agoric/time').TimerService} TimerService
|
|
29
29
|
*
|
|
30
30
|
* @typedef {object} Handler
|
|
31
31
|
* Handler is a user-provided Far object with .wake(time) used for callbacks
|
package/tools/manual-timer.js
CHANGED
|
@@ -6,8 +6,8 @@ import { TimeMath } from '@agoric/time';
|
|
|
6
6
|
import { buildRootObject } from '../src/vats/timer/vat-timer.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @typedef {import('@agoric/time
|
|
10
|
-
* @typedef {import('@agoric/time
|
|
9
|
+
* @typedef {import('@agoric/time').Timestamp} Timestamp
|
|
10
|
+
* @typedef {import('@agoric/time').TimerService} TimerService
|
|
11
11
|
* @typedef {import('../src/devices/timer/device-timer.js').Waker} Waker
|
|
12
12
|
*
|
|
13
13
|
* @typedef {object} ManualTimerCallbacks
|