Skip to content

OOM on Web due to ephemeral threads #3651

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

Open
Twey opened this issue Mar 26, 2025 · 0 comments
Open

OOM on Web due to ephemeral threads #3651

Twey opened this issue Mar 26, 2025 · 0 comments

Comments

@Twey
Copy link
Contributor

Twey commented Mar 26, 2025

Currently the way we implement threads in Wasm means that every new thread grows the single shared Wasm memory. Since Wasm provides no way to shrink the memory, this results in the memory usage growing with every new thread (i.e. every block executed) until it hits a browser-imposed limit and crashes.

Some solutions to this problem that I think should work, in ascending order of difficulty:

  • change linera-protocol to use a fixed-size pool of threads that are re-used when executing bytecode
  • change wasm-bindgen to use multiple memories, so that the thread's memory can be added to a fresh memory that is freed when the thread ends
  • change our fork of wasm-thread to track a thread's used memory and release it when the thread exits
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

No branches or pull requests

1 participant