Unitech / Unitech/pm2

PM2 Unable to Stop/Stuck Stopping Process

Open
#4,901 4 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

What's going wrong?

Basically im using PM2 to run a simple node.js file which runs my discord bot. I had it run and it was working for a while but when I went to stop it by deleting it I would get stuck on the [PM2] Applying action deleteProcessId on app [0](ids: [ '0' ]) message. I thought it might just be taking it a longer amount of time but I left it trying to delete overnight but when I came back in the morning it was still on that message. Whenever I pull up the list it shows its status as stopping constantly, its cpu as 0% and its memory at 0b. It seems as though its stuck on stopping it. The only thing I can think of that would be causing it to get stuck here is a forever loop in the code but I put a delay in it and the compiler should have been able to catch it.

Heres my pm2 report:

--- PM2 report ----------------------------------------------------------------
Date                 : Thu Oct 29 2020 09:39:37 GMT-0700 (Pacific Daylight Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 4.5.0
node version         : 12.18.3
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : paxton
uid                  : 502
gid                  : 20
uptime               : 3776min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 4.5.0
node version         : 12.18.3
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : paxton
uid                  : 502
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
cpus nb              : 8
freemem              : 878415872
totalmem             : 25769803776
home                 : /Users/paxton
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ bot                │ fork     │ 0    │ stopping  │ 0%       │ 0b       │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/paxton/.pm2/pm2.log last 20 lines:
PM2        | 2020-10-26T19:46:25: PM2 log: App [bot:0] online
PM2        | 2020-10-27T09:13:54: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T09:14:23: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T09:16:51: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T10:01:01: PM2 error: Process with pid 53847 already exists
PM2        | 2020-10-27T10:01:04: PM2 error: Process with pid 53847 already exists
PM2        | 2020-10-27T10:01:32: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T10:02:54: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T10:03:58: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T10:13:58: PM2 log: pm2 has been killed by signal, dumping process list before exit...
PM2        | 2020-10-27T10:13:58: PM2 log: Deleting process 0
PM2        | 2020-10-27T10:13:58: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T10:14:20: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-27T10:14:30: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-28T13:24:13: PM2 error: [RestartProcessId] PM2 is being killed, stopping restart procedure...
PM2        | 2020-10-28T13:24:21: PM2 error: [RestartProcessId] PM2 is being killed, stopping restart procedure...
PM2        | 2020-10-28T13:27:04: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-29T09:25:18: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-29T09:27:03: PM2 log: Stopping app:bot id:0
PM2        | 2020-10-29T09:33:00: PM2 log: Stopping app:bot id:0

If anyone know how to stop the program or why its doing this it would be greatly appreciated, thank you.

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

No source file or test is named. Start by reproducing the stuck delete state with PM2 4.5.0, Node.js 12.18.3, and macOS while reviewing the provided daemon logs; done means identifying the stop path that leaves the process in stopping state and adding coverage for it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.