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

implement dispatch.retireExports for Remotables #3297

Merged
merged 2 commits into from
Jun 14, 2021
Merged

Conversation

warner
Copy link
Member

@warner warner commented Jun 11, 2021

fix(swingset): implement dispatch.retireExports for Remotables

This updates liveslots to implement kernel-delivered
dispatch.retireExports, but only when the object being retired is a
Remotable (virtual objects are left alone for now).

Retiring an exported Remotable means we remove it from the slotToVal and
valToSlot tables, and unregister it from the droppedRegistry. At this
point, vat code might still hold a strong reference to the Remoteable, but
liveslots is unaware of it. If the vat re-exports the object, it will get a
new vref.

This also comments out some debug messages.

refs #3106

@warner warner added the SwingSet package: SwingSet label Jun 11, 2021
@warner warner added this to the Testnet: Stress Test Phase milestone Jun 11, 2021
@warner warner requested a review from FUDCo June 11, 2021 08:19
@warner warner self-assigned this Jun 11, 2021
@warner warner force-pushed the 3109-retire-exports branch 3 times, most recently from 7a0e550 to 634e1e6 Compare June 12, 2021 01:54
Base automatically changed from 3109-new-gc-actions to master June 12, 2021 03:03
Comment on lines +856 to +860
// virtual object: ignore for now, but TODO we must still not make
// syscall.retireExport for vrefs that were already retired by the
// kernel
Copy link
Contributor

@FUDCo FUDCo Jun 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unclear why virtual objects should be treated specially in this case. Is it related to the fact that virtual objects can still point to things even while being swapped out? If so I can see why letting them just get swept might leave dangling garbage on disk, but that's a "what's the proper procedure to delete this?" problem, not a "should we delete this?" problem. Otherwise I don't see how they're different from any other Remotable. What am I not understanding?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Virtual object GC is still pretty incomplete. dropExports effectively ignores them (Representatives are never put in exportedRemotables, and that's the only thing dropExports touches so far), so the virtualObjectManager is not yet being told that the kernel has given up reachability. retireExports is the kernel's way of giving up recognizability too, and we can't act upon that until we've first implemented the code that acts upon the drop.

The full flowchart for GC of virtual objects is the big one in #2724 (comment) . retireExports is one signal, but the algorithm must also keep track of any Representative and whether the vref is reachable from (and/or recognizable by) virtualized data. It isn't safe to forget the virtual object merely in response to retireExports.

When we're done, we'll definitely act upon dropExports and retireExports for virtual objects: ignoring them is a temporary measure until we build up more code to implement that large flowchart. But that's currently a minority use case (the only virtual objects we use so far are Purses, and they're relatively long-lived, at least compared to Payments and Offers and everything else that gets thrown around). And we do already have enough code to safely act upon it for Remotables, which ought to save us meaningful space now. So it's a phased-implementation approach.

My plan is to either build a separate "reachability manager" that manages that flowchart, or enhance the virtualObjectManager. At that point, retireOneExport will just do reachabilityManager.kernelRetired(vref) and let the other code figure out the consequences.

@warner warner requested a review from FUDCo June 13, 2021 18:36
Copy link
Contributor

@FUDCo FUDCo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go.

This updates liveslots to implement kernel-delivered
`dispatch.retireExports`, but only when the object being retired is a
Remotable (virtual objects are left alone for now).

Retiring an exported Remotable means we remove it from the `slotToVal` and
`valToSlot` tables, and unregister it from the `droppedRegistry`. At this
point, vat code might still hold a strong reference to the Remoteable, but
liveslots is unaware of it. If the vat re-exports the object, it will get a
new vref.
and make some enhancements should they ever need to be restored
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SwingSet package: SwingSet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants