Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite Node processes get spawned for invalid sandboxed workers #1587

Closed
VladimirMikulic opened this issue Dec 16, 2022 · 4 comments · Fixed by #1588 or #1663
Closed

Infinite Node processes get spawned for invalid sandboxed workers #1587

VladimirMikulic opened this issue Dec 16, 2022 · 4 comments · Fixed by #1588 or #1663

Comments

@VladimirMikulic
Copy link
Contributor

VladimirMikulic commented Dec 16, 2022

Hi! Recently, I encountered an issue where BullMQ would infinitely spawn node processes until the computer eventually runs out of memory and crashes. Here's the screenshot from my Linux box:

Screenshot_20221203_043444

This occurs when sanboxed processor JS file doesn't have/can't reach a valid default export.
(e.g. third party module throws, syntax typo etc.)

Reproduction

  1. Input 30+ tasks in Redis/BullMQ
  2. Create invalid Worker JS file, simplified example:
nonImportedFnCall();
module.exports = {
  // Your valid worker code
}
  1. Open your System Monitor and filter for Node process
  2. Start processing tasks and see Node processes spawning infinitely

I'd expect BullMQ to log a message like "Worker JS file could not have been imported" instead of spawning infinite Node processes. (silly mistakes happen, but that shouldn't be the reason to crash the host :)

Thanks!

@manast
Copy link
Contributor

manast commented Dec 16, 2022

On which version of BullMQ are you getting this behaviour?

@VladimirMikulic
Copy link
Contributor Author

@manast bullmq@3.4.2

github-actions bot pushed a commit that referenced this issue Dec 20, 2022
# [3.5.0](v3.4.2...v3.5.0) (2022-12-20)

### Bug Fixes

* **job:** fetch parent before job moves to complete ([#1580](#1580)) ([6a6c0dc](6a6c0dc))
* **sandbox:** throw error when no exported function ([#1588](#1588)) fixes [#1587](#1587) ([c031891](c031891))

### Features

* **queue:** add getJobState method ([#1593](#1593)) ref [#1532](#1532) ([b741e84](b741e84))
@VladimirMikulic
Copy link
Contributor Author

VladimirMikulic commented Dec 27, 2022

@roggervalf the issue is still present in the latest release 3.5.1
Node processes still spawn until they match the number of tasks in queue.
(i.e. 500 items in queue results in 500 Node processes when sandboxed worker.js is invalid / default export not reachable)

Here's my test case with 24 items in queue:
(you can ignore the first two Node processes which are servers)

Screenshot_20221227_095809

@manast
Copy link
Contributor

manast commented Feb 4, 2023

Let's reopen this one to investigate what is going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants