Unitech / Unitech/pm2

PM2 saves stopped status when system reboots

Open
#6,036 0 comments 0 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

I am running a program that will create a transient systemd scope on its own, and I reboot the system using systemctl reboot.

During the reboot process, systemd sends the SIGTERM to all processes. There is one situation where

  1. The program was killed by systemd, so PM2 marked it as STOPPED
  2. The PM2 then receives the SIGTERM and it dump the process list with status STOPPED

In this case, the program will not restart the program after reboot and ignore previous pm2 save with running program.

The ~/pm2/pm2.log looks like this

2025-09-18T11:04:12: PM2 log: App [hydro-sandbox:0] exited with code [0] via signal [SIGTERM]
2025-09-18T11:04:12: PM2 log: pm2 has been killed by signal, dumping process list before exit...
2025-09-18T11:04:12: PM2 log: Deleting process 0

The expected behavior is the PM2 should restart the App correctly after 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

Reproduce the reboot sequence with a transient systemd scope and inspect PM2's SIGTERM shutdown path, especially the process-list dump shown in the logs. Confirm that an app previously saved as running remains eligible to restart after reboot and is not persisted as STOPPED.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.