Unitech / Unitech/pm2

pm2 stop causes watching to stop working

Open
#5,487 4 comments 4 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?

after pm2 stop and pm2 start command, the watching feature not working at all even pm2 list showing it is enabled.
The only similar issue is found in https://github.com/Unitech/pm2/issues/4434 but no one answering and the bot just closed it.

How could we reproduce this issue?

Reproduction Step:

  1. Start the app with
pm2 start ecosystem.js
  1. ecosystem.js file has watch: true enabled
  2. pm2 list also showing watching enabled
  3. It works like charm until pm2 stop command is used.
  4. after using pm2 stop and pm2 start the process id, it does not works as expected and pm2 list still showing watching enabled.

Expected Behavior

pm2 stop and pm2 start the process, user save anything in any watching directory will trigger file change and restart the process.

Supporting information

$ pm2 report

--- Daemon -----------------------------------------------
pm2d version : 5.2.2
node version : 16.16.0
--- CLI ----------------------------------------------------
local pm2 : 5.2.2
node version : 16.16.0
--- System info --------------------------------------------
arch : x64
platform : darwin
type : Darwin

The only workaround to restart and remain watching are:

  1. pm2 restart instead of pm2 stop and pm2 start
  2. or pm2 delete the process and pm2 start again
  3. or pm2 kill and pm2 start again

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 issue with ecosystem.js using pm2 start, pm2 stop, and pm2 start, then inspect the watch state and process lifecycle around those commands. Done means watching remains functional after stop and start, with a regression test covering the sequence.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.