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

fix(swingset): gcAndFinalize needs two post-GC setImmediates on V8 #3486

Merged
merged 1 commit into from
Jul 22, 2021

Conversation

warner
Copy link
Member

@warner warner commented Jul 17, 2021

When testing the upcoming #3482 fix, we observed that a vat method which
simply delegates to a second vat, like this:

  getInvitationTarget: () => E(zoe).getInvitationZoe(),

would not always drop the "invitation" Presence returned by both methods,
when run under Node.js. It dropped the Presence correctly perhaps 20% of the
time, and the other 80% it failed to drop it. Under XS it dropped it all of
the time.

Node.js started working correctly all of the time (N=8 or so) when we changed
gcAndFinalize to do two setImmediates after the gc(), instead of just
one.

I'd like to add a unit test that fails with a similar probability, but I
haven't been able to come up with one. Either they fail to collect the object
all of the time, or none of the time.

refs #3240

Hopefully it fixes that, but I won't be sure until I run more load-generator
tests and look for growth in the object counts over time. And I'd like to add
that test before closing the issue.

@warner warner added the SwingSet package: SwingSet label Jul 17, 2021
@warner warner added this to the Testnet: Metering Phase milestone Jul 17, 2021
@warner warner requested a review from michaelfig July 17, 2021 04:29
@warner warner self-assigned this Jul 17, 2021
@warner warner force-pushed the 3240-better-gc-and-finalize branch from 4282c29 to 1fee5ef Compare July 22, 2021 06:35
@warner
Copy link
Member Author

warner commented Jul 22, 2021

@michaelfig and I worked on this together, so I'm going to assume his approval.

@warner warner requested review from JimLarson and mhofman and removed request for michaelfig and JimLarson July 22, 2021 06:38
Copy link
Member

@mhofman mhofman left a comment

Choose a reason for hiding this comment

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

Feels like voodoo incantations!

When testing the upcoming #3482 fix, we observed that a vat method which
simply delegates to a second vat, like this:

```js
  getInvitationTarget: () => E(zoe).getInvitationZoe(),
```

would not always drop the "invitation" Presence returned by both methods,
when run under Node.js. It dropped the Presence correctly perhaps 20% of the
time, and the other 80% it failed to drop it. Under XS it dropped it all of
the time.

Node.js started working correctly all of the time (N=8 or so) when we changed
`gcAndFinalize` to do *two* `setImmediate`s after the `gc()`, instead of just
one.

I'd like to add a unit test that fails with a similar probability, but I
haven't been able to come up with one. Either they fail to collect the object
all of the time, or none of the time.

refs #3240

Hopefully it fixes that, but I won't be sure until I run more load-generator
tests and look for growth in the object counts over time. And I'd like to add
that test before closing the issue.
@warner warner force-pushed the 3240-better-gc-and-finalize branch from 1fee5ef to c80e6c7 Compare July 22, 2021 08:29
@warner warner enabled auto-merge (squash) July 22, 2021 08:29
@warner warner merged commit cc9428f into master Jul 22, 2021
@warner warner deleted the 3240-better-gc-and-finalize branch July 22, 2021 09:00
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