-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Worker threads: the process keeps living on exception #22736
Labels
worker
Issues and PRs related to Worker support.
Comments
addaleax
added a commit
to addaleax/node
that referenced
this issue
Sep 9, 2018
- Initialize `thread_exit_async_` only once the thread has been started. This is done since it is only triggered from the thread when it is exiting. - Move the final `uv_run` to the `Worker` destructor. This makes sure that it is always run, regardless of whether the thread is actually started or not. - Always dispose the `Isolate` before cleaning up the libuv event loop. This now matches the reverse order of initialization. Fixes: nodejs#22736
3 tasks
targos
pushed a commit
that referenced
this issue
Sep 15, 2018
- Initialize `thread_exit_async_` only once the thread has been started. This is done since it is only triggered from the thread when it is exiting. - Move the final `uv_run` to the `Worker` destructor. This makes sure that it is always run, regardless of whether the thread is actually started or not. - Always dispose the `Isolate` before cleaning up the libuv event loop. This now matches the reverse order of initialization. Fixes: #22736 PR-URL: #22773 Reviewed-By: James M Snell <[email protected]>
targos
pushed a commit
that referenced
this issue
Sep 19, 2018
- Initialize `thread_exit_async_` only once the thread has been started. This is done since it is only triggered from the thread when it is exiting. - Move the final `uv_run` to the `Worker` destructor. This makes sure that it is always run, regardless of whether the thread is actually started or not. - Always dispose the `Isolate` before cleaning up the libuv event loop. This now matches the reverse order of initialization. Fixes: #22736 PR-URL: #22773 Reviewed-By: James M Snell <[email protected]>
targos
pushed a commit
that referenced
this issue
Sep 20, 2018
- Initialize `thread_exit_async_` only once the thread has been started. This is done since it is only triggered from the thread when it is exiting. - Move the final `uv_run` to the `Worker` destructor. This makes sure that it is always run, regardless of whether the thread is actually started or not. - Always dispose the `Isolate` before cleaning up the libuv event loop. This now matches the reverse order of initialization. Fixes: #22736 PR-URL: #22773 Reviewed-By: James M Snell <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The problem is related to Node.js worker threads: https://nodejs.org/api/worker_threads.html
The worker thread is spawned as illustrated in the following example:
And then this is the actual worker:
Now, worker threads do not support elements such as functions and classes in worker data and an exception is thrown when main.js is launched:
The output is this:
Unfortunately, the process keeps alive instead of dying.
However, if I prepend the v8 serialization before the worker instantiation, then it terminates as expected:
I think the issue is with v8 serialization's error handling inside the Worker's constructor.
The text was updated successfully, but these errors were encountered: