emscripten-core / emscripten-core/emscripten

How to handle exceptions that occur in pthreads (workers)

Open
#13,000 2 comments 0 reactions 0 assignees View on GitHub
wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

;TLDR; should we make such exceptions fatal? (as they are in the native world).

While working on a change targeting PROXY_TO_PTHREAD (#12994) it occurred to be that we should probably change the way we handle all exceptions that occur on workers.

Right now an exception on the workers (that occurs during the pthread's main function) is handled the creating thread (I believe that is always the main browser thread today) in the worker.onerror handler. All this functions does today is log the error keep on going. No exception is throw on the main thread today.

It occurs to me that is we want to match the behavior of native pthreads we should treat such exceptions as fatal the entire program (i.e. as if abort() was called), or at the very least re-throw the exception on the main thread.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.