pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

PM2 fails to start on server reboot -- invalid arg type

Open jaxonashton opened this issue 2 years ago • 0 comments

What's going wrong?

PM2 fails to start on server reboot

How could we reproduce this issue?

Not sure about reproducing the issue, but I can duplicate it on my Raspi by simply doing a sudo pm2 start

Supporting information

Screenshot at Jun 11 04-34-32

Output of pm2 report:

===============================================================================
--- PM2 REPORT (Sat Jun 11 2022 04:34:53 GMT-0400 (Eastern Daylight Time)) ----
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.0.0
node version         : 16.15.1
node path            : undefined
argv                 : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 5min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 3.0.0
node version         : 16.15.1
node path            : undefined
argv                 : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : arm
platform             : linux
type                 : Linux
cpus                 : ARMv7 Processor rev 3 (v7l)
cpus nb              : 4
freemem              : 319229952
totalmem             : 966447104
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌───────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬────────────┬──────┬──────────┐
│ App name  │ id │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem        │ user │ watching │
├───────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼────────────┼──────┼──────────┤
│ camera.js │ 0  │ fork │ 4968 │ online │ 0       │ 5m     │ 0%  │ 100.5 MB   │ root │ disabled │
│ cron.js   │ 1  │ fork │ 4974 │ online │ 0       │ 5m     │ 0%  │ 48.6 MB    │ root │ disabled │
└───────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴────────────┴──────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┬──────┐
│ Module        │ version │ target PID │ status │ restart │ cpu │ memory      │ user │
├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┼──────┤
│ pm2-logrotate │ 2.7.0   │ N/A        │ online │ 0       │ 0%  │ 40.648 MB   │ root │
└───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┴──────┘
===============================================================================
--- Daemon logs --------------------------------------------
⇆ Agent Online | Access: https://app.pm2.io/#/r/ga7zltyazmx090y | Server: network.classicyuppie.com | Transport [ 'WebsocketTransport' ]
┌───────────┬────┬──────┬──────┬────────┬─────────┬────────┬─────┬────────────┬──────┬──────────┐
│ App name  │ id │ mode │ pid  │ status │ restart │ uptime │ cpu │ mem        │ user │ watching │
├───────────┼────┼──────┼──────┼────────┼─────────┼────────┼─────┼────────────┼──────┼──────────┤
│ camera.js │ 0  │ fork │ 4968 │ online │ 0       │ 5m     │ 0%  │ 100.5 MB   │ root │ disabled │
│ cron.js   │ 1  │ fork │ 4974 │ online │ 0       │ 5m     │ 0%  │ 46.9 MB    │ root │ disabled │
└───────────┴────┴──────┴──────┴────────┴─────────┴────────┴─────┴────────────┴──────┴──────────┘
 Module activated
┌───────────────┬─────────┬────────────┬────────┬─────────┬─────┬─────────────┬──────┐
│ Module        │ version │ target PID │ status │ restart │ cpu │ memory      │ user │
├───────────────┼─────────┼────────────┼────────┼─────────┼─────┼─────────────┼──────┤
│ pm2-logrotate │ 2.7.0   │ N/A        │ online │ 0       │ 0%  │ 40.648 MB   │ root │
└───────────────┴─────────┴────────────┴────────┴─────────┴─────┴─────────────┴──────┘
 Use `pm2 show <id|name>` to get more details about an app

Output of cat /root/.pm2/pm2.log:

[2022-06-11T04:29:21.963Z] PM2 log: ===============================================================================
[2022-06-11T04:29:21.965Z] PM2 log: --- New PM2 Daemon started ----------------------------------------------------
[2022-06-11T04:29:21.967Z] PM2 log: Time                 : Sat Jun 11 2022 04:29:21 GMT-0400 (Eastern Daylight Time)
[2022-06-11T04:29:21.968Z] PM2 log: PM2 version          : 3.0.0
[2022-06-11T04:29:21.970Z] PM2 log: Node.js version      : 16.15.1
[2022-06-11T04:29:21.971Z] PM2 log: Current arch         : arm
[2022-06-11T04:29:21.972Z] PM2 log: PM2 home             : /root/.pm2
[2022-06-11T04:29:21.973Z] PM2 log: PM2 PID file         : /root/.pm2/pm2.pid
[2022-06-11T04:29:21.974Z] PM2 log: RPC socket file      : /root/.pm2/rpc.sock
[2022-06-11T04:29:21.975Z] PM2 log: BUS socket file      : /root/.pm2/pub.sock
[2022-06-11T04:29:21.977Z] PM2 log: Application log path : /root/.pm2/logs
[2022-06-11T04:29:21.978Z] PM2 log: Process dump file    : /root/.pm2/dump.pm2
[2022-06-11T04:29:21.979Z] PM2 log: Concurrent actions   : 2
[2022-06-11T04:29:21.980Z] PM2 log: SIGTERM timeout      : 1600
[2022-06-11T04:29:21.981Z] PM2 log: ===============================================================================
[2022-06-11T04:29:22.023Z] PM2 log: Starting execution sequence in -fork mode- for app name:camera.js id:0
[2022-06-11T04:29:22.029Z] PM2 log: Starting execution sequence in -fork mode- for app name:cron.js id:1
[2022-06-11T04:29:22.088Z] PM2 error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (4968)
    at Object.writeFileSync (node:fs:2163:5)
    at /usr/local/lib/node_modules/pm2/lib/God/ForkMode.js:240:12
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
    at next (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:5332:29)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:972:16
    at WriteStream.<anonymous> (/usr/local/lib/node_modules/pm2/lib/Utility.js:172:13)
    at WriteStream.emit (node:events:527:28)
    at WriteStream.emit (node:domain:537:15)
    at node:internal/fs/streams:72:16
    at FSReqCallback.oncomplete (node:fs:188:23)
[2022-06-11T04:29:22.092Z] PM2 log: App name:camera.js id:0 online
[2022-06-11T04:29:22.110Z] PM2 error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (4974)
    at Object.writeFileSync (node:fs:2163:5)
    at /usr/local/lib/node_modules/pm2/lib/God/ForkMode.js:240:12
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
    at next (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:5332:29)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:972:16
    at WriteStream.<anonymous> (/usr/local/lib/node_modules/pm2/lib/Utility.js:172:13)
    at WriteStream.emit (node:events:527:28)
    at WriteStream.emit (node:domain:537:15)
    at node:internal/fs/streams:72:16
    at FSReqCallback.oncomplete (node:fs:188:23)
[2022-06-11T04:29:22.112Z] PM2 log: App name:cron.js id:1 online
[2022-06-11T04:29:22.362Z] PM2 log: Starting execution sequence in -fork mode- for app name:pm2-logrotate id:2
[2022-06-11T04:29:22.397Z] PM2 error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (5008)
    at Object.writeFileSync (node:fs:2163:5)
    at /usr/local/lib/node_modules/pm2/lib/God/ForkMode.js:240:12
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
    at next (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:5332:29)
    at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:972:16
    at WriteStream.<anonymous> (/usr/local/lib/node_modules/pm2/lib/Utility.js:172:13)
    at WriteStream.emit (node:events:527:28)
    at WriteStream.emit (node:domain:537:15)
    at node:internal/fs/streams:72:16
    at FSReqCallback.oncomplete (node:fs:188:23)

jaxonashton avatar Jun 11 '22 08:06 jaxonashton