PM2 throws errors when used with projects managed by GIT
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?
When I start any PM2 app, I see the following error, over and over. The server starts, errors then tries to restart.
PM2 | ===============================================================================
PM2 | --- PM2 global error caught ---------------------------------------------------
PM2 | Time : Fri Oct 20 2023 11:41:22 GMT-0400 (Eastern Daylight Time)
PM2 | The argument 'path' must be a string or Uint8Array without null bytes. Received 'C:\\Users\\Sean\\Documents\\Ream\\.git\\\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...
PM2 | TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string or Uint8Array without null bytes. Received 'C:\\Users\\Sean\\Documents\\Ream\\.git\\\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0...
PM2 | at Object.readFile (node:fs:393:10)
PM2 | at Object.readFile (C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\node_modules\git-node-fs\lib\node-fs.js:18:10)
PM2 | at Object.readRef (C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\node_modules\js-git\mixins\fs-db.js:62:8)
PM2 | at resolveRef (C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\node_modules\js-git\mixins\walkers.js:104:8)
PM2 | at onShallow (C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\node_modules\js-git\mixins\walkers.js:18:5)
PM2 | at C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\node_modules\js-git\mixins\fs-db.js:89:7
PM2 | at C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\node_modules\git-node-fs\lib\node-fs.js:23:12
PM2 | at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3)
PM2 | at FSReqCallback.callbackTrampoline (node:internal/async_hooks:130:17)
PM2 | ===============================================================================
PM2 | [PM2] Resurrecting PM2
How could we reproduce this issue?
Every time I've seen this error it occurred after I did a push to upstream with GIT. Afterwards, pm2 will start throwing errors related to GIT. I'm not using the watch feature.
To confirm this is in fact the issue: When I moved the project's .git folder outside of the project, there's suddenly no problem at all.
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Fri Oct 20 2023 11:46:48 GMT-0400 (Eastern Daylight Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.3.0
node version : 16.14.2
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A
uptime : 5min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.3.0
node version : 16.14.2
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\Sean\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0 : node
user : Sean
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
cpus nb : 16
freemem : 22190993408
totalmem : 34108944384
home : C:\Users\Sean
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬─────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user
│ watching │
├────┼─────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0 │ page-app │ default │ N/A │ cluster │ N/A │ 0 │ 0 │ stopped │ 0% │ 0b │ Sean
│ disabled │
│ 1 │ user-app │ default │ N/A │ cluster │ N/A │ 0 │ 0 │ stopped │ 0% │ 0b │ Sean
│ disabled │
└────┴─────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
C:\Users\Sean\.pm2\pm2.log last 20 lines:
PM2 | 2023-10-20T11:41:26: PM2 log: ===============================================================================
PM2 | 2023-10-20T11:41:26: PM2 error: [PM2] Resurrecting PM2
PM2 | 2023-10-20T11:41:26: PM2 log: pid=25252 msg=process killed
PM2 | 2023-10-20T11:41:27: PM2 log: PM2 successfully stopped
PM2 | 2023-10-20T11:41:27: PM2 log: ===============================================================================
PM2 | 2023-10-20T11:41:27: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2 | 2023-10-20T11:41:27: PM2 log: Time : Fri Oct 20 2023 11:41:27 GMT-0400 (Eastern Daylight Time)
PM2 | 2023-10-20T11:41:27: PM2 log: PM2 version : 5.3.0
PM2 | 2023-10-20T11:41:27: PM2 log: Node.js version : 16.14.2
PM2 | 2023-10-20T11:41:27: PM2 log: Current arch : x64
PM2 | 2023-10-20T11:41:27: PM2 log: PM2 home : C:\Users\Sean\.pm2
PM2 | 2023-10-20T11:41:27: PM2 log: PM2 PID file : C:\Users\Sean\.pm2\pm2.pid
PM2 | 2023-10-20T11:41:27: PM2 log: RPC socket file : \\.\pipe\rpc.sock
PM2 | 2023-10-20T11:41:27: PM2 log: BUS socket file : \\.\pipe\pub.sock
PM2 | 2023-10-20T11:41:27: PM2 log: Application log path : C:\Users\Sean\.pm2\logs
PM2 | 2023-10-20T11:41:27: PM2 log: Worker Interval : 30000
PM2 | 2023-10-20T11:41:27: PM2 log: Process dump file : C:\Users\Sean\.pm2\dump.pm2
PM2 | 2023-10-20T11:41:27: PM2 log: Concurrent actions : 2
PM2 | 2023-10-20T11:41:27: PM2 log: SIGTERM timeout : 1600
PM2 | 2023-10-20T11:41:27: PM2 log: ===============================================================================
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Windows failure after a Git push, then trace the stack through git-node-fs/lib/node-fs.js, js-git/mixins/fs-db.js, and js-git/mixins/walkers.js during PM2 daemon resurrection. Done means PM2 no longer repeatedly errors or restarts when a project contains its .git directory, while normal startup still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, javascript, nodejs
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100