-
Notifications
You must be signed in to change notification settings - Fork 237
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 not deterministic? (weakrefs, SES shim) #564
Comments
Have you looked beyond the hash to characterize the differences? |
No... any suggestions on where to look? The outputs are the same size (~275k). They differ at around 125k. Occasionally two outputs match:
|
Running You note that sometimes there are zero, so maybe the other times it is a small number too? |
looks like around 24 to 26 bytes differ for the weakref case. For the SES bootstrap bundle, a couple thousand bytes seem to differ.
|
The others show 0. (I commented out
|
Thanks for the additional data. The two runs may be separate issues -- in the first, the differences are all in two byte groups whereas in h second they are in four byte groups. The two byte groups suggest that it could be the slot ID value (it is a two byte value). We anticipated that there could be challenges on the road deterministic snapshots. Here we are. ;) |
I looked into this a bit. In the weals/before.js case, the mismatched offsets are in the snapshots BLOC atom, which means they are in the chunk heap not a slot. So, my guess about slot ID values looks wrong. |
The differences are in the hash tables used internally by WeakMap and WeakSet. The hash used for objects depends on the address of the object's slot. When it occasionally works for you, either the addresses or their hashes are the same. I did a quick hack to eliminate the address dependency. The resulting snapshots match. But, it is a hack so the snapshots don't completely work on reload. Not sure yet about the best way to solve this. |
We pushed some changes to XS that give deterministic results for both the weak and generator tests. Those were separate issues. |
yay! It works here too. e0bdcf7 seems to be the fix. |
Build environment: Linux
Target device: xsnap
Description
I'm trying to get reproducible snapshot hashes a packaged version of our SES shim (see bootstrap.umd.js ) but they seem to be non-deterministic.
I reproduced the problem using just the weakref example that comes with xsnap:
Steps to Reproduce
xsnap
examples/weaks/before.js-w out.xss
xsnap examples/weaks/before.js -w out.xss
againExpected behavior
same snapshot
Other information
xsnap version 8b127bc
transcript:
cc @warner @dtribble @erights
The text was updated successfully, but these errors were encountered: