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

some Promises(?) not being garbage collected #701

Closed
warner opened this issue Sep 17, 2021 · 4 comments
Closed

some Promises(?) not being garbage collected #701

warner opened this issue Sep 17, 2021 · 4 comments
Labels
fixed - please verify Issue has been fixed. Please verify and close.

Comments

@warner
Copy link

warner commented Sep 17, 2021

I'm investigating a performance problem in our xsnap-based vat environment. In my test, I send a delivery into the vat, which does a fixed amount of work, and resolves a promise to indicate that it is complete. At the end of each delivery, our code forces a GC cycle. The symptom is that the GC cycle takes more and more time: it seems linear in the number of deliveries we've made. I added a line to print the->currentHeapCount, and it is growing (5 slots per cycle), indicating that something is not being garbage collected, and the ever-growing heap size would explain the longer GC cycle, which would explain the performance degradation.

I've narrowed the problem down to deliveries that perform an eventual-send using our HandledPromise implementation. I added a FinalizationRegistry to track some of the more visible Promises, and that reports them as being collected. I've also ruled out the handful of tables that we use to track these promises: their size remains constant.

We saw a similar bug before, and you were able to track it down to something in the Promise implementation that was failing to mark either a Promise or a handler function as free, in a particular situation that was provoked by our HandledPromise implementation. That bug was fixed back in June, in commit 22116a6. I'm guessing that this might be another variant of that bug.

I'm assembling an XSNAP_TEST_RECORD trace of the run for you to recreate the issue locally, I'll attach it here somehow.

@warner
Copy link
Author

warner commented Sep 17, 2021

https://gist.github.com/warner/726935311e0c0dbfd1417401e1082862 contains the replay log and details on the runtime versions.

@dckc
Copy link
Contributor

dckc commented Sep 17, 2021

re xsnap-pub version "...which should be pretty close to the version we got from Moddable", we're now keeping in sync with Moddable folks on all changes to xsnap-pub. They regularly review any changes we make.

@phoddie
Copy link
Collaborator

phoddie commented Sep 22, 2021

This has been tracked down to a problem with Map/Set when deleting items with an iterator active. Fix is pending.

mkellner pushed a commit that referenced this issue Sep 23, 2021
@phoddie phoddie added the fixed - please verify Issue has been fixed. Please verify and close. label Sep 23, 2021
@phoddie
Copy link
Collaborator

phoddie commented Oct 12, 2021

Closing as email discussions indicate this problem has been resolved.

@phoddie phoddie closed this as completed Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed - please verify Issue has been fixed. Please verify and close.
Projects
None yet
Development

No branches or pull requests

3 participants