Fix: pm2 on Windows - pm2 restart not always kill old process
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
Hello PM2 team,
During the tests I found why on the Windows sometimes after
pm2 restart
application starts more then one process.
Looks like the issue is in the function God.checkProcess.
Process.kill function does not always give the correct results. Sometimes the process can’t respond but the process is still alive.
Using the “tasklist” command for Windows solved this issue.
My MR with the fix: https://github.com/Unitech/pm2/pull/5458
This solution looks not perfect but I did a lot of tests (more than 500) restart and works very well.
Please send me confirmation if you can add this fix to the main source code.
Thanks
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
Start with the God.checkProcess function and inspect the linked pull request #5458 for the proposed Windows-specific fix. Reproduce pm2 restart behavior on Windows and verify that the old process is no longer running after repeated restarts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100