node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

CPU at 100% when forking processes that import node-redis

Open prlanzarin opened this issue 11 months ago • 0 comments

Description

In Node.js versions >= 20.x, forking child processes that import the Redis package while the application operates under the FIFO CPU scheduling policy causes both parent and child processes to hang indefinitely, consuming 100% CPU.

The issue does not occur if:

  • The Redis package is not imported.
  • The application is running under a different CPU scheduling policy.
  • The application is running on Node.js versions prior to 20.x.

This is reproducible with both [email protected] and [email protected].

The following repo has a sample reproducible application: https://github.com/prlanzarin/cp-fork-sample See the README for instructions.


PS.: I quickly poked at [email protected] and ended up figuring out that commenting the following prototype assignment got the application to stop misbehaving: https://github.com/redis/node-redis/blob/4f85030e42da2eed6a178e54994330af5062761e/lib/commands.js#L59 I've not looked into the equivalent breakpoint in 4.7.0.

PS2.: I reckon this may be a Node.js issue specifically, but I'm yet unable to reproduce this without any external dependencies - so I'm opening this issue here first.

Node.js Version

v22.11.0 (or 20.x)

Redis Server Version

6.0.16 malloc=jemalloc-5.2.1 bits=64

Node Redis Version

[email protected] (or [email protected])

Platform

Ubuntu 22.04 (or 20.04)

Logs

No response

prlanzarin avatar Nov 19 '24 13:11 prlanzarin