emscripten-core / emscripten-core/emscripten

How to avoid repeated downloading of dynamic library under multithreading

Open
#17,537 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 14h
Merged PRs (30d)
125

Description

Version of emscripten/emsdk: 3.1.15

If I use Multi-Thread and Side-Module, my project can run successful. But my dynamic libraries(about 30MB) will download some times,
one in main thread and others by my worker.js(PTHREAD_POOL_SIZE=30), this will waste lots of time and network bandwidth(about 1G).

① But in fact, I should only need to load it once,it will be fast and more reasonable, how can I share thoes dynamic libraries for other thread?
② What's more, the path of the dynamic library has changed。 When I set my dynamic libraries as below.
var Module = {
dynamicLibraries : [
"libs/XXX.so",
.....
],
}
it downloads libraries from //libs in main thread, however,it downloads libraries from //<worker.js-directory>/libs/ in worker.js thread。 so I need copyt it to other path.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the multithreaded side-module setup with dynamicLibraries, comparing the main thread and worker.js requests and their resolved paths. Done means determining whether the libraries are downloaded once and whether the same library path works from both execution contexts.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, wasm
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.