Unitech / Unitech/pm2

PM2 God Daemon Memory Leak (6.0.14)

Open
#6,113 1 comment 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

Hi,

I’m seeing what appears to be a serious memory leak in the PM2 God Daemon on PM2 v6.0.14.

Environment
PM2 version: 6.0.14
Node.js version: 20.20.2
OS: Linux x64 Debian 12
Architecture: AMD EPYC
Workload:
Long-running websocket game servers
Multiple Node.js cluster processes
uWebSockets.js
High-frequency websocket traffic
Problem

The PM2 God Daemon process gradually grows to very large memory usage over time.

After about 22 days uptime:

PM2 daemon RSS reached ~5.7GB
System memory pressure became dangerous
Applications themselves remained healthy

The issue appears isolated to the PM2 daemon process.

Important Details
Logs are NOT large

~/.pm2/logs size is only:

3.5M

So this does not appear to be caused by large log files.

Watch mode is disabled

All applications show:

watching: disabled
Restart counts are low

Most processes only restarted a few times.

No restart storm is occurring.

Applications remain stable

Game servers and backend services continue running normally while the PM2 daemon memory keeps increasing.

Current PM2 Report
pm2d version : 6.0.14
node version : 20.20.2
uptime : 31599min

Processes are running in cluster mode.

Suspicion

This may be related to:

PM2 internal IPC/event bus
stdout/stderr stream handling
cluster mode worker communication
websocket high-frequency output
daemon-side buffering/caching leak

Even though actual log files remain very small.

Temporary Fix

Restarting the PM2 daemon fixes the memory usage:

pm2 save
pm2 kill
pm2 resurrect

After restart, daemon memory returns to normal.

Additional Notes
No watch mode
No large logs
No massive restart loops
Memory growth is only observed in the PM2 daemon
Workload is websocket-heavy and long-running

Please let me know if additional debug information would help.

Thanks.

--- PM2 report ----------------------------------------------------------------
Date : Sat May 16 2026 16:13:59 GMT+0800 (Taiwan Standard Time)

--- Daemon -------------------------------------------------
pm2d version : 6.0.14
node version : 20.20.2
node path : /usr/bin/sh
argv : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0 : /usr/bin/node
user : root
uid : 0
gid : 0
uptime : 31599min

--- CLI ----------------------------------------------------
local pm2 : 6.0.14
node version : 20.20.2
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/lib/node_modules/pm2/bin/pm2,report
argv0 : /usr/bin/node
user : root
uid : 0
gid : 0

--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : AMD EPYC Processor
cpus nb : 16
freemem : 17771601920
totalmem : 33632563200
home : /root

--- PM2 list -----------------------------------------------
┌────┬──────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼──────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 6 │ alpha │ default │ 0.1.773 │ cluster │ 3695178 │ 3D │ 0 │ online │ 3.6% │ 246.3mb │ root │ disabled │
│ 5 │ beta │ default │ 0.1.573 │ cluster │ 3694641 │ 3D │ 1 │ online │ 0% │ 380.7mb │ root │ disabled │
│ 1 │ center │ default │ 0.0.183 │ cluster │ 3676961 │ 3D │ 8 │ online │ 7.1% │ 164.1mb │ root │ disabled │
│ 2 │ db │ default │ 0.0.111 │ cluster │ 3677294 │ 3D │ 7 │ online │ 7.1% │ 1.9gb │ root │ disabled │
│ 8 │ gs0 │ default │ 0.3.86 │ cluster │ 15117 │ 3D │ 10 │ online │ 3.6% │ 452.4mb │ root │ disabled │
│ 9 │ gs1 │ default │ 0.3.86 │ cluster │ 15251 │ 3D │ 3 │ online │ 0% │ 446.3mb │ root │ disabled │
│ 17 │ gs10 │ default │ 0.3.86 │ cluster │ 16289 │ 3D │ 3 │ online │ 0% │ 425.0mb │ root │ disabled │
│ 10 │ gs2 │ default │ 0.3.86 │ cluster │ 15393 │ 3D │ 4 │ online │ 0% │ 469.3mb │ root │ disabled │
│ 11 │ gs3 │ default │ 0.3.86 │ cluster │ 15525 │ 3D │ 3 │ online │ 0% │ 446.6mb │ root │ disabled │
│ 12 │ gs5 │ default │ 0.3.86 │ cluster │ 15650 │ 3D │ 3 │ online │ 3.6% │ 432.5mb │ root │ disabled │
│ 13 │ gs6 │ default │ 0.3.86 │ cluster │ 15771 │ 3D │ 2 │ online │ 3.6% │ 440.4mb │ root │ disabled │
│ 14 │ gs7 │ default │ 0.3.86 │ cluster │ 15906 │ 3D │ 3 │ online │ 3.6% │ 405.8mb │ root │ disabled │
│ 15 │ gs8 │ default │ 0.3.86 │ cluster │ 16038 │ 3D │ 4 │ online │ 0% │ 468.9mb │ root │ disabled │
│ 16 │ gs9 │ default │ 0.3.86 │ cluster │ 16157 │ 3D │ 4 │ online │ 0% │ 438.7mb │ root │ disabled │
│ 7 │ login │ default │ 0.0.231 │ cluster │ 878482 │ 2D │ 8 │ online │ 3.6% │ 165.3mb │ root │ disabled │
│ 3 │ role │ default │ 0.1.713 │ cluster │ 3844387 │ 3D │ 6 │ online │ 10.7% │ 735.6mb │ root │ disabled │
└────┴──────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module │ version │ pid │ status │ ↺ │ cpu │ mem │ user │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0 │ pm2-logrotate │ 3.0.0 │ 15355 │ online │ 0 │ 0% │ 78.9mb │ root │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘

--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:

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 daemon entry point shown in the report, lib/Daemon.js, and reproduce the long-running cluster workload while monitoring pm2d RSS. Compare the daemon's behavior before and after pm2 save, pm2 kill, and pm2 resurrect; done should identify the leak's source and demonstrate that daemon memory remains stable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
devops
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.