Unitech / Unitech/pm2

PM2 Issue with treekill: false and startup.

Open
#5,223 1 comment 2 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?

In my ecosystem.config.js file, I set treekill to false. The first time killing pm2 doesn't kill the child process I spawned before. After rebooting the server and trying it again treekill is ignored and the child process is killed too when I kill pm2.

How could we reproduce this issue?

treekill:false in ecosystem.config.js

pm2 save
pm2 startup

Spawning child process:

const run = spawn("sh", ["restart.sh"], {
      cwd: projectPath,
      detached: true,
      stdio: ["ignore", out, err],
    }).unref();

Restart.sh:

pm2 kill
pkill -9 PM2
<code>
reboot

After Server reboot: treekill:false doesn't work anymore.

Running Restart.sh after reboot:

pm2 kill <-- child process gets killed here too
pkill -9 PM2
<code>
reboot

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 with the ecosystem.config.js setting for treekill and the restart.sh sequence using pm2 kill, pkill -9 PM2, and reboot. Reproduce the behavior before and after pm2 save and pm2 startup, then determine why treekill:false is not preserved after reboot and verify that the child process remains alive.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.