Skip to content

[browser][mt] Propagate unhandled JS errors in JSWebWorker to the top level Task #76957

Open

Description

@lambdageek

If user code uses setTimeout to queue work on the JSWebWorker and that code throws unhandled exceptions, we should not bring down the whole runtime in a disorganized manner.

Should we propagate unhandled JS errors the JSWebWorker top level Task ?

Activity

  1. ghost added
    untriaged
    on Oct 12, 2022
  2. changed the title [-]protect pthread workers from unhandled JS exceptions.[/-] [+][wasm-mt] protect pthread workers from unhandled JS exceptions.[/+] on Oct 12, 2022
  3. added
    arch-wasm
    and removed
    untriaged
    on Oct 12, 2022
  4. added this to the 8.0.0 milestone on Oct 12, 2022
  5. modified the milestones: 8.0.0, 9.0.0 on Jul 24, 2023
  6. pavelsavara commented on Nov 9, 2023

    @pavelsavara
    Member

    I guess we don't have any manifestation of this yet?

    Anyway, I think that calling back from JS to C# will happen via JSExport and that propagates exceptions correctly.

    Is there another concern ?

  7. added
    os-browser
    on Nov 9, 2023
  8. changed the title [-][wasm-mt] protect pthread workers from unhandled JS exceptions.[/-] [+][browser][mt] protect pthread workers from unhandled JS exceptions.[/+] on Nov 9, 2023
  9. pavelsavara commented on Jan 31, 2024

    @pavelsavara
    Member

    We do subscribe to unhandledrejection and error top level events in the UI thread and shut down the runtime when that happens, when internal withExitOnUnhandledError is used.

    globalThis.addEventListener("unhandledrejection", (event) => handler(event, event.reason));
    globalThis.addEventListener("error", (event) => handler(event, event.error));

    Is that too strict ?
    Should we adopt the same on the JSWebWorker too ?

  10. self-assigned this
    on Jan 31, 2024
  11. pavelsavara commented on Jan 31, 2024

    @pavelsavara
    Member

    Maybe JSWebWorker should propagate unhandled JS errors from setTimeout to the JSWebWorker top level Task ?

  12. changed the title [-][browser][mt] protect pthread workers from unhandled JS exceptions.[/-] [+][browser][mt] Propagate unhandled JS errors in JSWebWorker to the top level Task[/+] on Feb 5, 2024
  13. modified the milestones: 9.0.0, Future on Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

arch-wasmarea-VM-threading-monoos-browser

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions