-
Notifications
You must be signed in to change notification settings - Fork 220
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 leaks memory during snapshot write #5975
Comments
My test program (https://github.com/Agoric/agoric-sdk/blob/614c849d61f8a2c24c82fbc48fcab29338774f25/packages/xsnap/test-snapshot-memleak.js) shows a memory leak of a trivial worker (just That makes the leak roughly proportional to the complexity of the heap (number of objects, properties, edges between objects, etc). Zoe is one of our more complicated vats, so the snapshots include a lot more slots, so the leak is faster. I've let the Moddable folks know. For now, our workaround of evicting each worker after each snapshot write is a decent one. If we really wanted to, we could claw back some performance by only evicting after every N snapshots, but I think it's better to wait for the upstream fix. |
The XS code does a really good job of not allocating memory. And I don't see anything obvious in the xsnap-worker.c code that might accumulate data created during the snapshot write. I do see that the |
Here's a patch to
|
Awesome. I've confirmed that fixes the leak. |
report the worker PID, create heap snapshots (to exercise #5975) leak
Next step: wait for Moddable to update the SDK, then make an https://github.com/agoric-labs/moddable PR to pull that in, then make an agoric-sdk PR to update our |
report the worker PID, create heap snapshots (to exercise #5975) leak Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Interim patch from Moddable to close the memory leak that happens each time a heap snapshot is written. refs Agoric/agoric-sdk#5975
This provides the upstream version of the snapshot-write memory leak fix, along with other bugfixes. closes #5975
This provides the upstream version of the snapshot-write memory leak fix, along with other bugfixes. closes #5975
This provides the upstream version of the snapshot-write memory leak fix, along with other bugfixes. closes #5975
I'm inclined to close this, since the symptoms are addressed by #5987 . The open issue now is some technical debt: we're out of sync with moddable master. We were keeping this open until that was addresses, presuming it would be straightforward; but #6011 turned out to be not straightforward. Do we want to track "we're out of sync with moddable" as an issue? @warner @kriskowal @mhofman ? |
I got a second from @mhofman and no objections on closing this. |
I was having trouble reproducing #5910 locally, by replaying a transcript extracted from the original slogfile. I realized that one thing the original was doing, but my replay was not, was writing out the periodic heap snapshot (every 200 deliveries or so). When I added that to
packages/SwingSet/misc-tools/replay-transcript.js
, I saw an immediate growth of thexsnap
process'VmRSS
size, about 5MB for every snapshot it wrote.I'll dive into
xsnap.c
next, but I'm guessing that a temporary buffer is allocated to write a snapshot, and then it is never freed.The text was updated successfully, but these errors were encountered: