dturing / node-gstreamer-superficial

Superficial gstreamer binding
MIT License
130 stars 45 forks source link

Worker Threads: "Module did not self-register" #10 #50

Closed sheunglaili closed 3 years ago

sheunglaili commented 3 years ago

When required in worker threads, It throws error "Module did not self-register"

I think this may be related to this issue https://github.com/nodejs/node/issues/21783#issuecomment-429637117 https://github.com/schroffl/node-lzo/pull/11/files

dturing commented 3 years ago

I've modified module initialization to use NODE_MODULE_INITIALIZER, which should make the module context-aware (1c946bf0692f25df30d415cb6dca9bbfa481ff17). I dont think gstreamer-superficial uses any global state, so i hope that has no side effects and the module now works well with worker threads. A quick test looked ok.

use version 1.7.1 from npm or later. thanks for reporting.

sheunglaili commented 3 years ago

Thank you so much !

mariusrak commented 1 year ago

I have this one-liner

new require('gstreamer-superficial').Pipeline('gst-launch-1.0 -v videotestsrc ! autovideosink').play()

and I get same error

module.js:681
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: Module did not self-register.
    at Object.Module._extensions..node (module.js:681:18)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/ubuntu/nodegst/index.js:1:75)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)

Why?

It's on jetson nano with ubuntu

dturing commented 11 months ago

can you still reproduce this, @mariusrak ?

because i can't; your one-liner doesnt work for me for a number of reasons (the "new" initialization doesnt work, the "gst-launch-1.0" is too much in the pipeline, and the script will quit right away).

do you still see the "Module did not self-register" issue?

mariusrak commented 11 months ago

Hi. This error somehow relates to nodejs version and package location. I'm not sure how, but when all the installation is correct and also the version of nodejs is correct, it seems that it works. But it seems to be fragile. However, I guess we can consider this closed.

Xeue commented 11 months ago

Hi all, I'm seeing this issue too in Node 20.8.1 running electron 27.0.0. Is this an electron messing with packages thing?