chore: bump napi: cache resolved guest callback functions to stop unbounded Store growth - #6850
Open
Arshia001 wants to merge 1 commit into
Open
Conversation
2 tasks
…ounded Store growth Fixes a real host-side memory leak found while load-testing edgejs: Function::from_vm_funcref (via Table::get) unconditionally pushes a new entry into the Store's function arena on every call with no dedup, and napi's callback trampoline was calling it on every single guest<->host callback invocation, growing the Store's functions Vec unboundedly for the life of the process. See wasmerio/napi#51.
Arshia001
force-pushed
the
chore/bump-napi-funcref-cache
branch
from
August 4, 2026 13:56
6fa4ba5 to
095b9cc
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the lib/napi git submodule to a newer wasmerio/napi commit that fixes a host-side memory leak by caching resolved guest callback Functions (keyed by __indirect_function_table index) instead of re-resolving them through Table::get on every guest↔host callback.
Changes:
- Bump
lib/napisubmodule from07190b8to1ee2b32. - Pull in napi fix that avoids unbounded
Storefunction-arena growth by caching resolved guest callback functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lib/napisubmodule to pick up fix: cache resolved guest callback functions to stop unbounded Store growth napi#51, which fixes a real host-side memory leak found while load-testing edgejs:Function::from_vm_funcref(invoked viaTable::get) unconditionally appends a new entry to the Store's function arena on every call with no dedup, and napi's callback trampoline (call_guest_callback/call_guest_callback2) was hitting this path on every single guest↔host callback invocation, growing the Store'sfunctionsVec unboundedly for the life of the process.Functionby the guest's stable__indirect_function_tableindex instead of re-resolving through the table on every invocation.Test plan
ENABLE_NAPI_V8=1 make build-wasmer) and reran a 90,000-connection raw-socket load test against edgejs with host RSS polling: RSS went from linear/unbounded growth (~4-5KB/connection, no plateau) to flat after initial warmup (394MB → 406MB over the first ~44s, then +0.7MB over the remaining ~72s covering the bulk of the 90k connections).Stacked on #6845.