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

Worker threads and Native addons requiring #25662

Closed
romainmnr opened this issue Jan 23, 2019 · 3 comments
Closed

Worker threads and Native addons requiring #25662

romainmnr opened this issue Jan 23, 2019 · 3 comments
Labels
addons Issues and PRs related to native addons. question Issues that look for answers. worker Issues and PRs related to Worker support.

Comments

@romainmnr
Copy link

Hi everyone !

I'm facing a problem using worker thread API and native addon (c++).
My purpose is to call native addon functions in a seperate thread to avoid blocking the main thread.
To do that i need to require my addon in each thread i'm creating but i have the error :

Error: Module did not self-register.

As it's written in the documentation, the worker_thread API doesn't support native addon for now..

My question is do you have an estimation date of this feature ?

Thanks.


Node: 10.15
Addon: c++ / node-gyp / node_addon_api

@bnoordhuis bnoordhuis added question Issues that look for answers. worker Issues and PRs related to Worker support. labels Jan 23, 2019
@KevinEady
Copy link
Contributor

Hi @bnoordhuis ,

There are multiple open issues relating to integrated in the way you are hoping for. In short, it is "in the works" I believe: #23265 and nodejs/user-feedback#51

@romainmnr
Copy link
Author

Ok thanks you :)

@legendecas
Copy link
Member

Requiring n-api modules in worker threads are supported AFAIK, tested on 10.15.1 and 11.9.0.

Could you require the native module in main module? i.e without worker threads.

@addaleax addaleax added the addons Issues and PRs related to native addons. label Feb 17, 2019
addaleax added a commit that referenced this issue Feb 25, 2019
Allow loading add-ons from multiple Node.js instances if they are
declared context-aware; in particular, this applies to N-API addons.

Also, plug a memory leak that occurred when registering N-API addons.

Refs: #23319

PR-URL: #26175
Fixes: #21481
Fixes: #21783
Fixes: #25662
Fixes: #20239
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
rvagg pushed a commit that referenced this issue Feb 28, 2019
Allow loading add-ons from multiple Node.js instances if they are
declared context-aware; in particular, this applies to N-API addons.

Also, plug a memory leak that occurred when registering N-API addons.

Refs: #23319

PR-URL: #26175
Fixes: #21481
Fixes: #21783
Fixes: #25662
Fixes: #20239
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addons Issues and PRs related to native addons. question Issues that look for answers. worker Issues and PRs related to Worker support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants