-
Notifications
You must be signed in to change notification settings - Fork 212
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
xsnap + SES boot not deterministic #2776
Comments
@dckc My understanding from conversations with @erights and @warner is that we expect deterministic JS execution from xsnapshots, but not binary identical snapshot files. I had come from the expectation that we’d be able to disseminate snapshots through a content address store among validators, but that appears to be a non-goal. That said, I would be unspeakably elated if snapshot binaries had consistent hashes. |
@phoddie , after discussion with @warner , @erights , and @kriskowal , we don't think Is it straightforward for you to reproduce this problem? That is: does If so, is it straightforward for you to tell why the snapshots are different? Once again, for reference: It's possible that we can do a sort of binary search thru p.s. re |
We can also send you two snapshots that differ but should have been the same. Would that be useful? |
Our goal has been what @kriskowal describes: to have the hashes match. We always expected some challenges along the way. For example, the snapshot code works to avoid writing uninitialized values into a snapshot. The recent changes to fix non-determinism in the snapshots for maps/sets was not because of uninitialized values. It was because some values changed depending on where in the address space the host operating system loaded the executable. The snapshot doesn't contain pointers, but it had hashes the included the address. (The snapshots were logically equivalent, but not identical data.) The interesting thing was that sometimes the macOS would load the executable at the same address, and in those cases the hash of the snapshot matched. In this case, is there a mismatch each time you generate the snapshot or only some? If the latter, may be you can trace a C function address at the start of xsnap to know if your snapshot is loaded at the same address to see if there is an address dependency. To the degree it is practical for you to simplify a test case that shows the problem, that will be helpful for us in looking into this further. FWIW - we don't have tools to dump a snapshot yet. At some point that is likely to be necessary. |
Unfortunately, this only shrinks the input by 1 line. There's a call to |
within the call to If I add a if (subPermit) {
// Property has a permit.
if (isWhitelistProperty(subPath, obj, prop, subPermit)) {
// Property is whitelisted.
// eslint-disable-next-line no-continue
continue;
}
} |
Array.prototype.reverse and Array.prototype.sort look odd with xsnap (vs xst): const info = Object.getOwnPropertyDescriptors(Array.prototype.reverse);
print('@@@array stuff', JSON.stringify(info));
const xx = Reflect.ownKeys(info).map(x => typeof x);
print('@@@@', JSON.stringify(xx));
const info2 = Reflect.ownKeys(Array.prototype.reverse);
print('@@@array stuff2', JSON.stringify(info2.map(x => typeof x))); note the extra
|
|
the |
It's not entirely clear how this got fixed, but it no longer fails. fixes #2776
It's not entirely clear how this got fixed, but it no longer fails. fixes #2776
It's not entirely clear how this got fixed, but it no longer fails. fixes #2776 * refactor: use makeSnapStoreIO in solo test * style: no-extraneous-dependencies for ava devDependencies * test: note snapshot determinism test must track SES shim etc. * test: move test-xsnap-store.js from solo to SwingSet ... now that SwingSet includes @agoric/swing-store as a dependency.
Describe the bug
xsnap
produces deterministic snapshots on simple examples (including weakmaps since Moddable-OpenSource/moddable#564 was fixed) but on the SES lockdown bootstrap we use, snapshots vary between evaluations.I can't say for certain that this is an
xsnap
bug yet; the problem could be in our 6200+ line SES bootstrap code somewhere.To Reproduce
bundle-ses-boot.umd.js
is available in https://gist.github.com/dckc/bba5b752d8176cbb9777fcc5c0bd916aExpected behavior
same snapshot
cc @warner @kriskowal @erights @michaelfig @phoddie
The text was updated successfully, but these errors were encountered: