Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Clean up wasm cache entries based on irreversibility & fix wavm module cleanup #6983

Closed
wants to merge 2 commits into from

Conversation

spoonincode
Copy link
Contributor

@spoonincode spoonincode commented Mar 22, 2019

Change Description

wasm cache entries have previously remained indefinitely creating a sort of memory leak. If using the wavm runtime this also creates a performance drag. This change is a naive fix to clean the wasm cache. It improves upon #2701 in that it waits for irreversibility before cleaning the cache (reducing cache thrashing around forks), and it also implements the garbage collection tracking for wavm so that wavm will actually free its instances.

Unfortunately there are still problems with this naive approach that makes this change not acceptable. For one, code instantiated on a fork that is thrown out is never pruned. More severely, code that is shared by multiple accounts tends to be overly pruned because getting a reference count of code used upon nodeos startup is required to avoid that.

This is mainly be put up as draft at this time to judge improvement with #6909. Unfortunately we still leave a lot of performance on the table with wavm (nearly 50%) even with this fix but it should at least not grind to a halt any longer.

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

When we instantiate a wasm with wavm we get back a ModuleInstance. But deleting this object is a noop because wavm has its own garpage collection thing. Implement the code to interface with the garbage collection so that deleting a ModuleInstance can really free up the objects that are associated with it
previously wasm cache entries would remain indefinitely, becoming a sort of "memory leak". This is a naive change that cleans up entries once a replacement has occured and passed irreversiblity
@spoonincode spoonincode mentioned this pull request Apr 19, 2019
3 tasks
@spoonincode
Copy link
Contributor Author

superseded by other PRs

@kj4ezj kj4ezj deleted the wasm_cache_pruning branch July 19, 2021 17:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant