0

When I am running a worker file inside a nodeJs application in a loop it gives error as :

Module did not self-register: '/server/node_modules/onnxruntime-node/bin/napi-v3/linux/x64/onnxruntime_binding.node'.

Here is my code:

const MyPomise = await new Promise((resolve, reject) => {
    const worker = new Worker("../server/workers/create.js", {
      workerData: { MessageList: listToSend }
    });
    worker.on("message", resolve);
    worker.on("error", reject);
  });
  const Data = await MyPomise;

Note: Above code is running worker file for the first time but giving error when running this in loop or requesting to run on second request in controller file.

5
  • I just noticed something: MyPromise is not a Promise, as you already await it. Commented Mar 11, 2024 at 12:35
  • @MarioSantini i checked removing await before MyPromise...still getting same issue Commented Mar 12, 2024 at 10:01
  • I thin it will be easier if you provide a minimal viable example that reproduce your issue. I attempted to do that with a trivial worker, but didn't had the same error. You shoul at least include the for loop in the code example. Commented Mar 12, 2024 at 10:16
  • @MarioSantini Actually this code i am running in a controller where multiple request are coming (I am not using loop in this case). But I am able to return the response for the first call, and getting error for the next request onwards. Same error I am getting if i used in loop at different place(My second use case). Commented Mar 12, 2024 at 10:53
  • Seems like issue with my package which I am importing in create.js(my worker file) is not loading second time because of some issue. Otherwise worker_thread is working fine. Commented Mar 15, 2024 at 10:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.