You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When training network within a worker thread, the thread fails to start and throws Error: Module did not self-register.
Where does it happen?
On Worker thread initialization, node.js v10.19.0 - LTS, KDE Neon (linux) 5.18, base Ubuntu 18.04
How do we replicate the issue?
Require brain.js in the main thread OR worker thread, it seems. init.js - Main thread
/* eslint-disable */constbrain=require('brain.js');// NOTE - If you comment this line out, it continues as normal.constworker=require('worker_threads');if(!worker.isMainThread){console.error('Called from main thread. Illegal. Exiting...');process.exit(1);}else{trainBrain().then(console.log).catch(console.error);}functiontrainBrain(){returnnewPromise((resolve,reject)=>{constchild=newworker.Worker('./worker.js',{workerData: {foo: 'bar',num: 1}});child.on('online',()=>console.log('Worker online'));child.on('message',resolve);child.on('error',reject);});}
worker.js - Worker thread
/* eslint-disable */constworker=require('worker_threads');constbrain=require('brain.js');// NOTE - If you comment this line out, it continues as normal.if(worker.isMainThread){console.error('Worker file called at main thread. Illegal. Exiting...');process.exit(1);}const{ workerData }=worker;const{ foo, num }=workerData;worker.parentPort.postMessage({ foo, num });
How important is this (1-5)?
2?
Expected behavior (i.e. solution)
In init.js OR worker.js, comment out the brain require statement. Somehow, removing the brain.js require seems to fix the issue.
Other Comments
If you're not already aware, worker_threads in node v10.x is an experimental feature, hidden behind the --experimental_worker flag. If you want to enable it, run the command as follows: node --experimental_worker init.js. https://nodejs.org/dist/latest-v10.x/docs/api/worker_threads.html
First try is without the brain require commented out. Second try is with the brain require commented out.
The text was updated successfully, but these errors were encountered:
What is wrong?
When training network within a worker thread, the thread fails to start and throws
Error: Module did not self-register.
Where does it happen?
On Worker thread initialization, node.js v10.19.0 - LTS, KDE Neon (linux) 5.18, base Ubuntu 18.04
How do we replicate the issue?
Require brain.js in the main thread OR worker thread, it seems.
init.js
- Main threadworker.js
- Worker threadHow important is this (1-5)?
2?
Expected behavior (i.e. solution)
In
init.js
ORworker.js
, comment out the brain require statement. Somehow, removing the brain.js require seems to fix the issue.Other Comments
If you're not already aware,
worker_threads
in node v10.x is an experimental feature, hidden behind the--experimental_worker
flag. If you want to enable it, run the command as follows:node --experimental_worker init.js
.https://nodejs.org/dist/latest-v10.x/docs/api/worker_threads.html
First try is without the brain require commented out. Second try is with the brain require commented out.
The text was updated successfully, but these errors were encountered: