Skip to content

fix(java): use dedicated executor for WASM compilation#313

Closed
mfranberg wants to merge 2 commits intomainfrom
mfranberg/fix-wasm-compilation-executor
Closed

fix(java): use dedicated executor for WASM compilation#313
mfranberg wants to merge 2 commits intomainfrom
mfranberg/fix-wasm-compilation-executor

Conversation

@mfranberg
Copy link

@mfranberg mfranberg commented Mar 4, 2026

Summary

ThreadLocalSwapWasmResolverApi was submitting N parallel WASM compilations to ForkJoinPool.commonPool() via CompletableFuture.runAsync(). Since the common pool also has ~N threads, this saturated it and starved other async work in the JVM (observed in service thread dumps).

This adds a dedicated fixed thread pool capped at 2 threads (wasm-compiler-%d, daemon) and passes it to both runAsync call sites in init() and updateStateAndFlushLogs(). The executor is shut down gracefully in close().

Test plan

  • All 83 existing tests pass (mvn test -f openfeature-provider/java/pom.xml)

🤖 Generated with Claude Code

mfranberg and others added 2 commits March 4, 2026 18:07
…mon pool

ThreadLocalSwapWasmResolverApi was submitting N parallel WASM compilations
to ForkJoinPool.commonPool() via CompletableFuture.runAsync(). Since the
common pool also has ~N threads, this saturated it and starved other async
work in the JVM.

Add a dedicated fixed thread pool capped at 2 threads for WASM compilation,
with daemon threads named wasm-compiler-%d. The executor is shut down
gracefully in close().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nicklasl
Copy link
Member

nicklasl commented Mar 5, 2026

Note to self: Let's re-apply on top of compositional refactor.

@nicklasl nicklasl closed this Mar 9, 2026
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.

2 participants