-
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
collectionManager: refcount remotables in keyShape/valueShape #7334
Conversation
Two of the new tests are disabled because I haven't been able to figure out how to avoid the "unhandled rejection" error from flunking the test. @gibson042 I could probably use your help figuring out that one. |
hrm, something is failing in a packages/vats upgrade test, feels like the refcounts are causing something to get deleted by mistake, will investigate tomorrow |
93cb8ae
to
b147977
Compare
b147977
to
c260cc8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Possibly also a new contender for largest ratio of test size to code change size .
082f244
to
83155ef
Compare
a9b2fad
to
db996d0
Compare
The collection schema (keyShape/valueShape) can refer to specific Remotable instances (e.g. Presence, or a durable object), rather than defining a constraint to be a whole category of objects. The collection schema metadata is thus a form of write-once state storage, like a tiny virtual object. Previously, defineKind failed to increment the refcount on the objects' vrefs, so when the collection falls out of memory, the object might be deleted, and then we would be unable to revive the constraint when loading the schema back in later. This changes the code to increment the refcounts of the vrefs in keyShape and valueShape when the collection is created, and decrement them when the collection is deleted. It handles ephemeral Remotables, as well as virtual/durable object Representatives. For durable collections, it also enforces the same `isDurable` check on the schema as it would on keys and values of the collection itself, so you cannot use a `Far()` or a merely-virtual object in the valueShape of a durable collection. closes #7321
Check that the refcounts are maintained correctly
db996d0
to
5af1b31
Compare
collectionManager: refcount remotables in keyShape/valueShape
The collection schema (keyShape/valueShape) can refer to specific
Remotable instances (e.g. Presence, or a durable object), rather than
defining a constraint to be a whole category of objects. The
collection schema metadata is thus a form of write-once state storage,
like a tiny virtual object.
Previously, defineKind failed to increment the refcount on the
objects' vrefs, so when the collection falls out of memory, the object
might be deleted, and then we would be unable to revive the constraint
when loading the schema back in later.
This changes the code to increment the refcounts of the vrefs in
keyShape and valueShape when the collection is created, and decrement
them when the collection is deleted. It handles ephemeral Remotables,
as well as virtual/durable object Representatives. For durable
collections, it also enforces the same
isDurable
check on the schemaas it would on keys and values of the collection itself, so you cannot
use a
Far()
or a merely-virtual object in the valueShape of adurable collection.
closes #7321