Skip to content
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

fix(ext/node): allow automatic worker_thread termination #22647

Merged
merged 12 commits into from
Mar 13, 2024

Conversation

satyarohith
Copy link
Member

This PR fixes node_worker to auto exit after script execution is completed. It doesn't update Deno worker behaviour as the spec expects users to manually terminate the web worker.

Closes #22629

@mash-graz
Copy link
Contributor

Thanks for working on this issue!

But just a small remark concerning the questionable standard compliant behavior of Deno.Worker.

Even if you add this code fragment:

w.onclose = () => { console.log("worker closed"); w.terminate() };

the application will not stop!

It will get the close-event, but the additional w.terminate() doesn't change the termination issue affecting the main process. :(

@mash-graz
Copy link
Contributor

This whole issue looks close related to #14318

runtime/js/99_main.js Outdated Show resolved Hide resolved
runtime/web_worker.rs Outdated Show resolved Hide resolved
@satyarohith
Copy link
Member Author

FYI: #22826 is a pre-requisite for this PR. cc @bartlomieju

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I confirmed the test hangs on main, but passes in Node.js and this PR. Nice work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

node:worker_threads and WebAPI Workers don't terminate
5 participants