Skip to content

PM2 throws errors when used with projects managed by GIT #5696

@thavus

Description

@thavus

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: ===============================================================================

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions