Unitech / Unitech/pm2

'pm2 stop' doesn't kill the process

Open
#4,858 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

Software Components: PM2 version: 4.4.1 , Windows 2016 server, Node.js version : 12.13.1

PM2 stop <app_name> , doesn't stop the process. It shows the status as "errored".
When I check the process in Windows Task Manager, I see the application process running even after Pm2 stop <process_name>.

Also, tried with increasing the Kill Timeout as well as with forceful (-f) option , but no luck.
Below is the log message even if there is no traffic -

2020-09-21T23:47:29: PM2 log: pid=9916 msg=failed to kill - retrying in 100ms
2020-09-21T23:47:29: PM2 log: pid=9916 msg=failed to kill - retrying in 100ms
2020-09-21T23:47:29: PM2 log: pid=9916 msg=failed to kill - retrying in 100ms
2020-09-21T23:47:29: PM2 log: Process with pid 9916 could not be killed
2020-09-21T23:47:29: PM2 error: app=testMS id=1 pid=9916 could not be stopped

As a workaround, I'm doing with "pm2 delete all" ; and then "pm2 restart all"

But, I have some requirement where I need to stop with - "pm2 stop <process_name>" only

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows Server 2016 failure with the pm2 stop <process_name> command and inspect the logged failed to kill and could not be stopped messages. Trace the stop command's Windows process-termination path, then verify that the target process exits and PM2 reports it as stopped rather than errored.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.