Sending SIGUSR2 signal to a stopped process bricks the whole cluster
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
If one sends a SIGUSR2 to a stopped process the other processes stop responding.
How could we reproduce this issue?
Checkout pm2 repo.
# Setup cluster
cd examples/cluster-http
echo 'process.on("SIGUSR2", () => { console.log('SIGUSR2'); });' >> http-no-exit.js
pm2 start ecosystem.config.js
curl 'http://localhost:8002' && echo "ok" || echo "fail"
# ^^ It works!!!
pm2 sendSignal SIGUSR2 0 &
curl 'http://localhost:8002' && echo "ok" || echo "fail"
# ^^ It works!!!
pm2 stop 0 &
curl 'http://localhost:8002' && echo "ok" || echo "fail"
# ^^ It works!!!
pm2 sendSignal SIGUSR2 0 &
curl 'http://localhost:8002' && echo "ok" || echo "fail"
# ^^ It does not work
Supporting information
$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date : Fri Dec 16 2022 14:26:20 GMT-0500 (Eastern Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.2.2
node version : 16.11.1
node path : /Users/<USER>/.nvm/versions/node/v16.11.1/bin/pm2
argv : /Users/<USER>/.nvm/versions/node/v16.11.1/bin/node,/Users/<USER>/.nvm/versions/node/v16.11.1/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : oleg
uid : 501
gid : 20
uptime : 3min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.2.2
node version : 16.11.1
node path : /Users/<USER>/.nvm/versions/node/v16.11.1/bin/pm2
argv : /Users/<USER>/.nvm/versions/node/v16.11.1/bin/node,/Users/<USER>/.nvm/versions/node/v16.11.1/bin/pm2,report
argv0 : node
user : oleg
uid : 501
gid : 20
===============================================================================
--- System info --------------------------------------------
arch : arm64
platform : darwin
type : Darwin
cpus : Apple M1 Max
cpus nb : 10
freemem : 11419484160
totalmem : 68719476736
home : /Users/<USER>
===============================================================================
List of processes or logs does not contain anything interesting.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure from examples/cluster-http using ecosystem.config.js and the appended http-no-exit.js handler, comparing curl responses before and after stopping process 0 and sending SIGUSR2. Trace the pm2 sendSignal command for the stopped process; done means the remaining cluster processes continue responding to requests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100