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

Cannot require sqlite3 in both a main thread and a worker thread #1223

Closed
mohd-akram opened this issue Sep 27, 2019 · 3 comments
Closed

Cannot require sqlite3 in both a main thread and a worker thread #1223

mohd-akram opened this issue Sep 27, 2019 · 3 comments

Comments

@mohd-akram
Copy link
Contributor

OS: macOS 10.14.6
node version: 12.10.0
sqlite3 version: 4.1.0

  1. Create main.js:
const { Worker } = require('worker_threads');
require('sqlite3');
new Worker('./worker.js');
  1. Create worker.js:
require('sqlite3');
  1. Run node main.js

Output:


events.js:186
      throw er; // Unhandled 'error' event
      ^
Error: Module did not self-register.
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:977:18)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
    at Object.<anonymous> (/Users/user/Downloads/test-sqlite3/node_modules/sqlite3/lib/sqlite3.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:936:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
    at Module.load (internal/modules/cjs/loader.js:790:32)
    at Function.Module._load (internal/modules/cjs/loader.js:703:12)
Emitted 'error' event on Worker instance at:
    at Worker.[kOnErrorMessage] (internal/worker.js:176:10)
    at Worker.[kOnMessage] (internal/worker.js:186:37)
    at MessagePort.<anonymous> (internal/worker.js:118:57)
    at MessagePort.emit (events.js:209:13)
    at MessagePort.onmessage (internal/worker/io.js:70:8)
@kewde
Copy link
Collaborator

kewde commented Sep 30, 2019

Hi,

worker_thread is unsupported at the moment.
See #1007

and the PR was reverted:
#1009

I don't know why it was reverted, so I will investigate.

@pacop
Copy link

pacop commented Oct 28, 2019

Hi,

is some news right here? Thanks @kewde

@mohd-akram
Copy link
Contributor Author

This is fixed in v5.0.0, but there are other issues with worker threads.

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

3 participants