-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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 throws exception while loading npm lib #21783
Comments
probably related to #21611? |
Seems like it can be related, is this PR going to be accepted or there's going to be a different approach on solving this? |
@danrevah I’m hoping to eventually require addons to explicitly opt in into supporting workers. Maybe that’s better through a warning than disabling it completely, though. |
Hi, any updates? I was under the impression worker threads supported npm libs. |
@alexcastillo It does, but native add-ons are a special case and you’ll need to contact the add-on author about this. |
Thanks for the clarification, @addaleax! |
I'm running into this as well when using experimental workers that try to load the lzo package. If this is something that addon authors need to handle, is there documentation or an example somewhere on how to do that? Also, is this issue a duplicate of #21481? |
It looks like making your module context-aware fixes the issue, see the docs#Context-aware addons. NODE_MODULE(NODE_GYP_MODULE_NAME, Init) Into this: NODE_MODULE_INIT() {
Init(exports);
} But that's because I don't touch the global context, if you do you'll need to use the |
@fathyb Thanks for the pointer. That helped us update node-lzo to work with worker threads in schroffl/node-lzo#11 |
Another affected module is |
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>
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>
the following code fails if I'm trying to run it, seems the problem comes from the marked line below.
'node-rdkafka' is a external library I'm using, and I was tempted to try and see if I could improve performance with the new worker threads.
while a worker is loaded, there's an error thrown saying 'Module did not self-register'.
this lib does work perfectly without the worker thread.
Angular 4-6+ Pipes - https://github.com/danrevah/ngx-pipes
The text was updated successfully, but these errors were encountered: