Skip to content

3.1.58 breaks usage in Node.js worker #21827

Closed

Description

@toyobayashi

minimum repro:

https://github.com/toyobayashi/emscripten-node-worker-3158-repro
https://github.com/toyobayashi/emscripten-node-worker-3158-repro/actions/runs/8827891977

issue 1: Cannot find correct .wasm path when run emscripten generated JavaScript in a Node.js Worker.
issue 2: The empty *.worker.js is written in cwd, not the same directory where .js exists.
issue 3: Pthread worker will read incorrect .wasm file again even if I specified locateFile when -sSTRICT=1

Activity

  1. sbc100 commented on Apr 25, 2024

    @sbc100
    Collaborator

    Is this perhaps a duplicate of #21826?

    The core misunderstand there seems to be that pthreads need to be able to locate the wasm file. In fact pthreads recieve the wasm module via postMessage so they should never be trying to locate or read the wasm file themselves.

    I believe the issue that caused some confusion in #21826 was that locateFile is still being called on worker startup, even though the worker is never using the result of that call. I think I will update the code so workers never actaully call locateFile to avoid this confusion.

  2. toyobayashi commented on Apr 25, 2024

    @toyobayashi
    ContributorAuthor

    not sure whether issue 3 is duplicated, but I confirm 1 and 2 are not related to #21826.

    I mean run emscripten js in my own Node.js worker (the worker is emscripten's main thread), please take a look the repro code and CI test, it does break something.

  3. toyobayashi commented on Apr 25, 2024

    @toyobayashi
    ContributorAuthor

    Issue 1 has nothing to do with locateFile, after I experienced issue 1, I tried to use locateFile to solve it then experienced issue 3.

  4. sbc100 commented on Apr 25, 2024

    @sbc100
    Collaborator

    So we have a fix for (2) in #21830 and (3) in #21829.

    That just leaves (1) which still needs some investigation.

  5. sbc100 commented on Apr 25, 2024

    @sbc100
    Collaborator

    Final fix is in #21832. I will push for a new release sooner rather than later to get these fixes out.

  6. added a commit that references this issue on Apr 25, 2024
    bd19c93
  7. added a commit that references this issue on Apr 25, 2024
    7c0d2e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions