Skip to content

Metrics breaks the PM2 on Node.js v24 #309

@Igloczek

Description

@Igloczek

pm2/io is crashing the whole app process, forcing the app to restart, just because the metrics logic is failing

app-1  | {"level":30,"time":1756732462503,"pid":143,"hostname":"47458b7faa29","msg":"Server listening on http://0.0.0.0:3000"}
app-1  | TypeError: Cannot read properties of undefined (reading 'toFixed')
app-1  |     at Object.handler (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/metrics/eventLoopMetrics.js:68:41)
app-1  |     at Timeout._onTimeout (/usr/local/lib/node_modules/pm2/node_modules/@pm2/io/build/main/services/metrics.js:60:39)
app-1  |     at listOnTimeout (node:internal/timers:608:17)
app-1  |     at process.processTimers (node:internal/timers:543:7)
app-1  | 2025-09-01T13:14:23: PM2 log: App name:server id:1 disconnected
app-1  | 2025-09-01T13:14:23: PM2 log: App [server:1] exited with code [0] via signal [SIGINT]
app-1  | 2025-09-01T13:14:23: PM2 log: App [server:1] starting in -cluster mode-
app-1  | 2025-09-01T13:14:23: PM2 log: App [server:1] online
app-1  | {"level":30,"time":1756732465087,"pid":155,"hostname":"47458b7faa29","msg":"Server listening on http://0.0.0.0:3000"}

To reproduce, just start any app and let it run in the background for about 2-3 minutes, it will eventually start crashing.

Breaks on Node.js v24.7.0, works fine on Node.js v22.19.0 and older ones.
Tested on both PM2 v5 and v6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions