Nodejs worker lead server crash

Environment questions

server artifacts : windows 5181

Important parts

What is the issue you’re having?
Nodejs worker lead server crash
What are you trying to do?
Create A Worker on Nodejs (On server)
What have you tried already to fix the issue?
yes
Error screenshot (if any):
image

Repo
Create a js resource on server

const file = './main.js'

const {
    Worker, isMainThread, parentPort, workerData
  } = require('worker_threads');
  if (isMainThread) {
    const worker = new Worker(file);
      worker.on('message', (resolve)=> {
          console.log('reslove')
      });
      worker.on('error', (reject)=> {
          console.log('err', reject)
      });
      worker.on('exit', (code) => {
        if (code !== 0)
          (new Error(`Worker stopped with exit code ${code}`));
      });
  } else {
    const script = workerData;
    parentPort.postMessage((script));
  }

and copy a it to main folder
it should cotain ‘cache’ folder and ‘resources’ folder.
image

and when you start the resource it will crash immediately.


Additional comments

Hello, this is a friendly reminder because this is your first time creating a topic (or it has been a while since your last topic) in this category.

Please note that most of the support is provided by the Cfx.re community on a voluntary basis. We ask you to be patient; there is no guarantee we have a solution to your problem(s). To avoid unnecessary/duplicate topics, please browse the forums before creating a topic.

To improve your chances of your issue(s) being solved, please provide as much information as possible about the issue(s) you are having. Also —whenever possible— please use the template given to you when creating a topic.

Thanks for keeping these forums tidy!
:mascot:

I can’t seem to replicate this issue (on build 5196): it prints reslove just fine.

Stopping/starting this resource does lead to a crash, but a different one from the one you listed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.