Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

record worker bundleIDs in vat metadata, use during reload #7208

Closed
warner opened this issue Mar 21, 2023 · 2 comments · Fixed by #7272
Closed

record worker bundleIDs in vat metadata, use during reload #7208

warner opened this issue Mar 21, 2023 · 2 comments · Fixed by #7272
Assignees
Labels
SwingSet package: SwingSet vaults_triage DO NOT USE
Milestone

Comments

@warner
Copy link
Member

warner commented Mar 21, 2023

Here's the new plan, to replace the #6596 of making a new package for the stable "worker-v1" behavior.

  • we'll land swingset-xsnap-supervisor (extract swingset-xsnap-supervisor out to a separate package #7063), but abandon swingset-worker-xsnap-v1 (create new swingset-worker-xsnap-v1 package #7101)
  • we'll leave everything in the monorepo, no changes to the release process
  • we'll enhance @FUDCo's new bundleStore to accept nestedEvaluate bundles too (with an ID that's probably the hash of the JSON encoding of the whole bundle object) (make bundleStore accept nestedEvaluate bundles too #7190)
  • when the kernel is initialized, we'll sample the lockdown and supervisor bundles, store them in the bundleStore under their hash IDs, and add a pair of kvStore keys to remind the kernel of what the "current lockdown/supervisor bundle ID" are
  • when creating a new vat, the kernel will copy these IDs into some per-vat metadata (in options)
  • when launching a vat worker, we'll use the metadata IDs to pull the lockdown/supervisor bundles from the bundleStore and feed them to the new worker, instead of using fixed copies

Originally posted by @warner in #6596 (comment)

@warner warner self-assigned this Mar 21, 2023
@warner warner added the SwingSet package: SwingSet label Mar 21, 2023
@warner warner added this to the Vaults EVP milestone Mar 21, 2023
@warner warner changed the title record worker bundleIDs in vat metadata record worker bundleIDs in vat metadata, use during reload Mar 21, 2023
@ivanlei ivanlei added the vaults_triage DO NOT USE label Mar 27, 2023
@gibson042
Copy link
Member

Does this include #7012?

warner added a commit that referenced this issue Mar 30, 2023
When launching an xsnap worker, we must load two special bundles into
the worker's empty JS engine: xsnap-lockdown (which turns it into
a SES environment), and swingset-xsnap-supervisor (which loads
liveslots and the command handlers). We get these bundles from
packages of the same names.

Previously, we would load the current versions of these bundles each
time the controller/kernel started, and use them for all vats started
or upgraded during that incarnation of the controller (i.e. until the
process exited). This did not maintain stable behavior for a vat which
e.g. does not record a heap snapshot before its initial controller
incarnation finishes: if the xsnap-lockdown package were updated
between controller incarnations, the second incarnation would launch
the worker with a different bundle than the first, potentially causing
divergence between the vat's original behavior (as recorded in its
transcript) and the replay. If there were any local-manager liveslots
-based vats, these would suffer the same problem on every kernel
reboot, since only xsnap-hosted vats can use heap snapshots.

With this commit, the lockdown and supervisor bundles are stored in
the swing-store `bundleStore`, and their IDs are recorded in the
metadata for each vat. We check the bundle-providing packages each
time we start a new vat (or upgrade an existing one), so the new
worker will use the latest bundles. But by recording the IDs
separately for each vat, we ensure that every launch of that vat
worker will the same bundles. This stability will help us maintain the
deterministic behavior of a vat despite changes to the packages
depended upon by any given version of the kernel.

Unit tests and replay tools can use `options.overrideBundles=[..]` to
replace the usual bundles with alternates: either no bundles, or
custom lockdown/supervisor bundles.

closes #7208
warner added a commit that referenced this issue Mar 30, 2023
When launching an xsnap worker, we must load two special bundles into
the worker's empty JS engine: xsnap-lockdown (which turns it into
a SES environment), and swingset-xsnap-supervisor (which loads
liveslots and the command handlers). We get these bundles from
packages of the same names.

Previously, we would load the current versions of these bundles each
time the controller/kernel started, and use them for all vats started
or upgraded during that incarnation of the controller (i.e. until the
process exited). This did not maintain stable behavior for a vat which
e.g. does not record a heap snapshot before its initial controller
incarnation finishes: if the xsnap-lockdown package were updated
between controller incarnations, the second incarnation would launch
the worker with a different bundle than the first, potentially causing
divergence between the vat's original behavior (as recorded in its
transcript) and the replay. If there were any local-manager liveslots
-based vats, these would suffer the same problem on every kernel
reboot, since only xsnap-hosted vats can use heap snapshots.

With this commit, the lockdown and supervisor bundles are stored in
the swing-store `bundleStore`, and their IDs are recorded in the
metadata for each vat. We check the bundle-providing packages each
time we start a new vat (or upgrade an existing one), so the new
worker will use the latest bundles. But by recording the IDs
separately for each vat, we ensure that every launch of that vat
worker will the same bundles. This stability will help us maintain the
deterministic behavior of a vat despite changes to the packages
depended upon by any given version of the kernel.

Unit tests and replay tools can use `options.overrideBundles=[..]` to
replace the usual bundles with alternates: either no bundles, or
custom lockdown/supervisor bundles.

closes #7208
warner added a commit that referenced this issue Mar 30, 2023
When launching an xsnap worker, we must load two special bundles into
the worker's empty JS engine: xsnap-lockdown (which turns it into
a SES environment), and swingset-xsnap-supervisor (which loads
liveslots and the command handlers). We get these bundles from
packages of the same names.

Previously, we would load the current versions of these bundles each
time the controller/kernel started, and use them for all vats started
or upgraded during that incarnation of the controller (i.e. until the
process exited). This did not maintain stable behavior for a vat which
e.g. does not record a heap snapshot before its initial controller
incarnation finishes: if the xsnap-lockdown package were updated
between controller incarnations, the second incarnation would launch
the worker with a different bundle than the first, potentially causing
divergence between the vat's original behavior (as recorded in its
transcript) and the replay. If there were any local-manager liveslots
-based vats, these would suffer the same problem on every kernel
reboot, since only xsnap-hosted vats can use heap snapshots.

With this commit, the lockdown and supervisor bundles are stored in
the swing-store `bundleStore`, and their IDs are recorded in the
metadata for each vat. We check the bundle-providing packages each
time we start a new vat (or upgrade an existing one), so the new
worker will use the latest bundles. But by recording the IDs
separately for each vat, we ensure that every launch of that vat
worker will the same bundles. This stability will help us maintain the
deterministic behavior of a vat despite changes to the packages
depended upon by any given version of the kernel.

Unit tests and replay tools can use `options.overrideBundles=[..]` to
replace the usual bundles with alternates: either no bundles, or
custom lockdown/supervisor bundles.

closes #7208
@warner
Copy link
Member Author

warner commented Mar 30, 2023

Does this include #7012?

Nope. It records and retains the xsnap-lockdown and swingset-xsnap-supervisor bundles (whatever is present in the corresponding dependencies under node_modules/ when the vat is started or upgraded). But it makes no attempt to measure or influence the xsnap that is used.

We'll have to refrain from changing the xsnap dependency in non-completely-compatible ways between the release that we use for the bulldozer upgrade, and the subsequent Vaults+1 upgrade release.

During that window, we'll probably implement some sort of metadata flag to say "use xsnap-1.x", and we'll figure out some sort of aliased dependency so that "1.x" can coexist with a subsequent "2.x". We won't have that metadata in the bulldozer-created vats, but it wants to live in vatOptions.workerOptions.xsnapVersion, added to the existing { type: 'xsnap', bundleIDs }. We'll have to treat the lack of that field as meaning the initial version.

warner added a commit that referenced this issue Mar 30, 2023
When launching an xsnap worker, we must load two special bundles into
the worker's empty JS engine: xsnap-lockdown (which turns it into
a SES environment), and swingset-xsnap-supervisor (which loads
liveslots and the command handlers). We get these bundles from
packages of the same names.

Previously, we would load the current versions of these bundles each
time the controller/kernel started, and use them for all vats started
or upgraded during that incarnation of the controller (i.e. until the
process exited). This did not maintain stable behavior for a vat which
e.g. does not record a heap snapshot before its initial controller
incarnation finishes: if the xsnap-lockdown package were updated
between controller incarnations, the second incarnation would launch
the worker with a different bundle than the first, potentially causing
divergence between the vat's original behavior (as recorded in its
transcript) and the replay. If there were any local-manager liveslots
-based vats, these would suffer the same problem on every kernel
reboot, since only xsnap-hosted vats can use heap snapshots.

With this commit, the lockdown and supervisor bundles are stored in
the swing-store `bundleStore`, and their IDs are recorded in the
metadata for each vat. We check the bundle-providing packages each
time we start a new vat (or upgrade an existing one), so the new
worker will use the latest bundles. But by recording the IDs
separately for each vat, we ensure that every launch of that vat
worker will the same bundles. This stability will help us maintain the
deterministic behavior of a vat despite changes to the packages
depended upon by any given version of the kernel.

Unit tests and replay tools can use `options.overrideBundles=[..]` to
replace the usual bundles with alternates: either no bundles, or
custom lockdown/supervisor bundles.

closes #7208
warner added a commit that referenced this issue Apr 4, 2023
When launching an xsnap worker, we must load two special bundles into
the worker's empty JS engine: xsnap-lockdown (which turns it into
a SES environment), and swingset-xsnap-supervisor (which loads
liveslots and the command handlers). We get these bundles from
packages of the same names.

Previously, we would load the current versions of these bundles each
time the controller/kernel started, and use them for all vats started
or upgraded during that incarnation of the controller (i.e. until the
process exited). This did not maintain stable behavior for a vat which
e.g. does not record a heap snapshot before its initial controller
incarnation finishes: if the xsnap-lockdown package were updated
between controller incarnations, the second incarnation would launch
the worker with a different bundle than the first, potentially causing
divergence between the vat's original behavior (as recorded in its
transcript) and the replay. If there were any local-manager liveslots
-based vats, these would suffer the same problem on every kernel
reboot, since only xsnap-hosted vats can use heap snapshots.

With this commit, the lockdown and supervisor bundles are stored in
the swing-store `bundleStore`, and their IDs are recorded in the
metadata for each vat. We check the bundle-providing packages each
time we start a new vat (or upgrade an existing one), so the new
worker will use the latest bundles. But by recording the IDs
separately for each vat, we ensure that every launch of that vat
worker will the same bundles. This stability will help us maintain the
deterministic behavior of a vat despite changes to the packages
depended upon by any given version of the kernel.

Unit tests and replay tools can use `options.overrideBundles=[..]` to
replace the usual bundles with alternates: either no bundles, or
custom lockdown/supervisor bundles.

closes #7208
warner added a commit that referenced this issue Apr 5, 2023
When launching an xsnap worker, we must load two special bundles into
the worker's empty JS engine: xsnap-lockdown (which turns it into
a SES environment), and swingset-xsnap-supervisor (which loads
liveslots and the command handlers). We get these bundles from
packages of the same names.

Previously, we would load the current versions of these bundles each
time the controller/kernel started, and use them for all vats started
or upgraded during that incarnation of the controller (i.e. until the
process exited). This did not maintain stable behavior for a vat which
e.g. does not record a heap snapshot before its initial controller
incarnation finishes: if the xsnap-lockdown package were updated
between controller incarnations, the second incarnation would launch
the worker with a different bundle than the first, potentially causing
divergence between the vat's original behavior (as recorded in its
transcript) and the replay. If there were any local-manager liveslots
-based vats, these would suffer the same problem on every kernel
reboot, since only xsnap-hosted vats can use heap snapshots.

With this commit, the lockdown and supervisor bundles are stored in
the swing-store `bundleStore`, and their IDs are recorded in the
metadata for each vat. We check the bundle-providing packages each
time we start a new vat (or upgrade an existing one), so the new
worker will use the latest bundles. But by recording the IDs
separately for each vat, we ensure that every launch of that vat
worker will the same bundles. This stability will help us maintain the
deterministic behavior of a vat despite changes to the packages
depended upon by any given version of the kernel.

Unit tests and replay tools can use `options.overrideBundles=[..]` to
replace the usual bundles with alternates: either no bundles, or
custom lockdown/supervisor bundles.

closes #7208
@mergify mergify bot closed this as completed in #7272 Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SwingSet package: SwingSet vaults_triage DO NOT USE
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants