Node: Worker Threads memory leak

Created on 23 May 2019  路  4Comments  路  Source: nodejs/node

Hi!
How many workers (worker_threads) can I make?
Are any limits (per core, per thread, etc.?)?
I have a very huge memory leak with 30 workers (CPU 6 cores, 12 threads, i7-8700), it will be around 3-4gb ram, without worker threads around 200-300mb. Wtf? Is it a bug?
And I have an error with MaxListenersExceededWarning.

worker

Most helpful comment

And can you fill out the issue template while you're at it? We ask it for a reason.

All 4 comments

Are you able to provide code that reproduces the issue?

And can you fill out the issue template while you're at it? We ask it for a reason.

Closing for now, no follow-up from OP.

So I have array storage in the main file.
For ex.:

main.js

let store = []
worker.on('message', items => {
  store = store.concat(items)
  if (store.length > N) {
    ...someActionWithStore()
    store = []
  }
})

worker.js

setInterval(() => {
  const items = getItems() // around 200 items per iteration
  parentPort.postMessage(items)
}, 1000)

Active workers: ~50
RAM: 3-4gb
Without workers RAM: 300-500mb.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmichae3 picture jmichae3  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

cong88 picture cong88  路  3Comments

dfahlander picture dfahlander  路  3Comments

fanjunzhi picture fanjunzhi  路  3Comments