bullmq icon indicating copy to clipboard operation
bullmq copied to clipboard

Option not to reuse child process

Open maxaggedon opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. When we started using bullmq to process jobs, we thought it would spawn a child process for each job. But we realised it does not...

Describe the solution you'd like This would bring the advantage of not risking to have a memory leak induced by a dependency, as the child process memory would be released after each job.

Describe alternatives you've considered We have patched it to exit the child process after each job, but it would be nice to have it as an official worker option

Additional context

maxaggedon avatar Feb 13 '24 16:02 maxaggedon

Yes, the reason why it reuses the process is because it is slow to spawn a new process for every job. If you already have a solution it would be great if you could contribute with a patch, as long as the default stays the same as today it would work.

manast avatar Feb 13 '24 17:02 manast

I have noticed an issue regarding memory leak. Where services increase in memory, till NodeJS restarts, due to OOM.

wernermorgenstern avatar Mar 08 '24 15:03 wernermorgenstern