Skip to content

fix: ICP-8826: Workaround for allocation issue in wasmtime-java - #202

Merged
JamieSinn merged 2 commits into
mainfrom
ICP-8826-use-csharp-init
Aug 19, 2026
Merged

fix: ICP-8826: Workaround for allocation issue in wasmtime-java#202
JamieSinn merged 2 commits into
mainfrom
ICP-8826-use-csharp-init

Conversation

@JamieSinn

@JamieSinn JamieSinn commented Aug 19, 2026

Copy link
Copy Markdown
Member

wasmtime-java has a leak whenever any linker function is retrieved, thus resulting in a massive leak every iteration when it's fetched as part of the variable evaluation hot path.

This adopts the same premise as the C# SDK where storing this reduces, but does not resolve the leak entirely. This minimizes the cost, but it still has a large initial RSS leak that cannot be fixed as each function is initialized/mapped.

Close #195

wasmtime-java has a leak whenever any linker function is retrieved, thus resulting in a massive leak every iteration when it's fetched as part of the variable evaluation hot path.

This adopts the same premise as the C# SDK where storing this reduces, but does not resolve the leak entirely.
This minimizes the cost, but it still has a large initial RSS leak that cannot be fixed as each function is initialized/mapped.

Due to the EOL of DVC coming - this is the only fix we can reasonably make with acceptable turnarounds.
@JamieSinn
JamieSinn requested a review from a team as a code owner August 19, 2026 19:19
Copilot AI lite review requested due to automatic review settings August 19, 2026 19:19
@JamieSinn JamieSinn changed the title ICP-8826: Workaround for allocation issue in wasmtime-java fix: ICP-8826: Workaround for allocation issue in wasmtime-java Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR mitigates native memory growth in the local bucketing path by avoiding repeated WASM export resolution (which leaks native handles in wasmtime-java), shifting export binding to LocalBucketing construction time.

Changes:

  • Cache WASM Func bindings (via WasmFunctions.*) as LocalBucketing fields and reuse them across calls.
  • Add an export(String name) helper to resolve exports once and fail fast on missing exports.
  • Update the release workflow commit email used for automated version bumps.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/main/java/com/devcycle/sdk/server/local/bucketing/LocalBucketing.java Caches WASM function bindings and adds a helper for one-time export resolution to reduce per-call native handle leaks.
.github/workflows/release.yml Updates the git author email used in the release commit step.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +112 to +114
* <p>The returned {@link Func} owns a native handle that is only released by
* {@code Func.dispose()}, so these must not be fetched per call.
*
Comment on lines +122 to +125
* <p>Runtime error behaviour is otherwise unchanged: WASM traps still surface as
* {@code WasmtimeException} from the calling method, and a trap does not invalidate these
* bindings. See {@code LocalBucketingErrorHandlingTest}.
*/
@JamieSinn
JamieSinn force-pushed the ICP-8826-use-csharp-init branch from 1f6cf0a to 2e7a8d8 Compare August 19, 2026 19:33
@JamieSinn
JamieSinn enabled auto-merge (squash) August 19, 2026 19:41
@JamieSinn
JamieSinn merged commit 6c8cb18 into main Aug 19, 2026
9 checks passed
@JamieSinn
JamieSinn deleted the ICP-8826-use-csharp-init branch August 19, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local bucketing leaks native memory (it's causing OOMs)

3 participants