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

Expose threadpool cleanup #73

Merged
merged 2 commits into from
Jun 24, 2023

Conversation

RReverser
Copy link
Contributor

Exposing threadpool cleanup from libuv + adding missing API.

While proper cleanup is not critical in Node.js, where exiting process automatically kills all associated threads, it's important for environments like Stackblitz where otherwise spawned Worker will be stuck waiting on a condvar (on an atomic) forever in background even after the Node.js command has finished, leading to Worker leaks.

@toyobayashi
Copy link
Owner

Thank you for pointing out this, I added the public API uv_library_shutdown, which internally calls uv__threadpool_cleanup.

@toyobayashi toyobayashi merged commit be127f0 into toyobayashi:main Jun 24, 2023
6 checks passed
@RReverser RReverser deleted the threadpool-cleanup branch June 24, 2023 12:04
@RReverser
Copy link
Contributor Author

Thank you for pointing out this, I added the public API uv_library_shutdown, which internally calls uv__threadpool_cleanup.

Hm I just added uv__threadpool_cleanup to EXPORTED_FUNCTIONS and called it from JS, that seemed to be enough. But I see libuv has uv_library_shutdown as well, so I guess makes sense to add it too.

@RReverser
Copy link
Contributor Author

Could you do a patch or minor release please?

@toyobayashi
Copy link
Owner

Done.

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.

2 participants