Skip to content

child_process.fork + node-redis sample for reproducing CPU stuck at 100% whenever CPUSchedulingPolicy is set to FIFO

License

Notifications You must be signed in to change notification settings

prlanzarin/cp-fork-sample

Repository files navigation

Sample Application for Reproducing a Node.js Redis Package Issue

This repository provides a minimal setup to reproduce a Node.js issue involving the Redis package under specific conditions.

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. Note that the Redis package does not need to be actively used, just imported.

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.

Tested envs/deps:

  • Node.js 20.x or later
  • Redis package: 3.1.2 and 4.7.0
  • Ubuntu 20.04 or 22.04
  • Redis server: 6.0.16 malloc=jemalloc-5.2.1 bits=64

Steps to Reproduce:

  1. Ensure Node.js version 20.x or later is installed on your system.
  2. Clone this repository into the /tmp directory:
  3. Copy the systemd unit file and reload systemd:
      sudo cp /tmp/cp-fork-sample/cp-fork-sample.service /etc/systemd/system/
      sudo systemctl daemon-reload
    • Note: Update the ExecStart path in the unit file to point to your Node.js binary.
  4. Start the service:
      sudo systemctl start cp-fork-sample

About

child_process.fork + node-redis sample for reproducing CPU stuck at 100% whenever CPUSchedulingPolicy is set to FIFO

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published