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

ERROR: Module did not self-register #412

Closed
ghost opened this issue Oct 2, 2023 · 2 comments
Closed

ERROR: Module did not self-register #412

ghost opened this issue Oct 2, 2023 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 2, 2023

Application run for a while but then crashes on said error. In my case: Error: Module did not self-register: '/home/vojtech/Work/myproject/node_modules/isolated-vm/out/isolated_vm.node'.

Isolated-vm runs in separated thread-worker. After every evaluation i release context, jail and script and before another one i create new ones.

OS: Ubuntu 22.04.3 LTS
NODE: v16.20.2
build-essential: 12.9ubuntu3
g++: 4:11.2.0-1ubuntu1
python: Python 3.10.12
gcc 11.4.0

Whole stack trace looks like this:

node:internal/event_target:1011
  process.nextTick(() => { throw err; });
                           ^
Error: Module did not self-register: '/home/vojtech/Work/myproject/node_modules/isolated-vm/out/isolated_vm.node'.
    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1282:18)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/home/vojtech/Work/myproject/node_modules/isolated-vm/isolated-vm.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Object.require.extensions.<computed> [as .js] (/home/vojtech/Work/myproject/node_modules/ts-node/src/index.ts:1608:43)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
Emitted 'error' event on Main instance at:
    at Main.[kOnErrorMessage] (node:internal/worker:298:10)
    at Main.[kOnMessage] (node:internal/worker:309:37)
    at MessagePort.<anonymous> (node:internal/worker:205:57)
    at MessagePort.[nodejs.internal.kHybridDispatch] (node:internal/event_target:736:20)
    at MessagePort.exports.emitMessage (node:internal/per_context/messageport:23:28) {
  code: 'ERR_DLOPEN_FAILED'
}

What i have tried: Rebuild with npm rebuild, reinstall package, tried node 18 and behavior did not change.

Any ideas what am i missing or how to fix this?

@laverdet
Copy link
Owner

laverdet commented Oct 2, 2023

Are you using workers? If so can you try importing isolated-vm from the primary module? You don't have to do anything with it, just import to create a strong reference. This is probably #402.

@ghost
Copy link
Author

ghost commented Oct 5, 2023

It looks like creating strong reference in main thread did the trick. Thank you.

@ghost ghost closed this as completed Oct 5, 2023
This issue was closed.
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

No branches or pull requests

1 participant