-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: move ExitCode processing into worker
Previously, the SwingSet-side `manager-subprocess-xsnap.js` asked the `xsnap` package for the integers corresponding to the three meter-based error exits: E_TOO_MUCH_COMPUTATION, E_STACK_OVERFLOW, and E_NOT_ENOUGH_MEMORY. It needs these to distinguish an in-consensus vat termination from a random I-don't-know-why-so-panic-the-kernel worker exit. However, that required SwingSet to have a direct dependency on `@agoric/xsnap`, whereas we really want the xsnap version to be entirely encapsulated by the new swingset-worker-xsnap-v1 package. Imagine how this would work when we introduce a -v2 package, which e.g. uses a new xsnap that has changed the exit code values. This commit adds a new `trapMeteringFailure()` method to the workers created by `swingset-worker-xsnap-v1`. This method inspects the error object (including the exit code), and either converts it into a termination-reason string (for the three recognized meter-based exits), or throws an error (for anything else). The manager can call this worker method instead of needing to know the exact exit codes, delegating knowledge of the details to the specific worker version. This allows SwingSet to lose the direct dependency upon @agoric/xsnap, relegating it to `devDependencies`.
- Loading branch information
Showing
5 changed files
with
23 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters