pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

Multiple interpreter_args

Open kopacko opened this issue 2 years ago • 2 comments

What's going wrong?

My pm2 config file has 2 interpreter_args in the string. The second option does not appear to be parsed or enabled.

Arg #1 : --no-experimental-fetch Arg #2 : --trace-warnings

How could we reproduce this issue?

{
  name              : "[REDACTED]",
  args              : "",
  cwd               : "[REDACTED]",
  env               : {
      NODE_ENV      : "development",
  },
  interpreter_args  : "--no-experimental-fetch --trace-warnings",
  script            : "[REDACTED].js",
  watch             : false
},

Supporting information

When I use pm2 monit I only see Arg #1 enabled. [See below]

App Name              [REDACTED]
Namespace             default
Version               0.4.0
Restarts              351
Uptime                37m
Script path           [REDACTED]/[REDACTED].js
Script args           --[REDACTED] --[REDACTED] --[REDACTED]
Interpreter           node
Interpreter args      --no-experimental-fetch
Exec mode             fork
Node.js version       18.17.1

You can see [above] that only the first argument is displayed. But there are 3 script arguments that are all passed.

In testing this app, I got the following log message from the app:

6|[REDACTED] | (Use node --trace-warnings ... to show where the warning was created)

This is what lead me to see via pm2 monit that the second node interpreter arg was not being passed.

# Run the following commands
$ pm2 report
--- PM2 report ----------------------------------------------------------------
Date                 : Fri Jan 05 2024 11:46:30 GMT-0600 (Central Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.3.0
node version         : 18.17.1
node path            : not found
argv                 : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 7661min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.3.0
node version         : 18.17.1
node path            : /usr/bin/pm2
argv                 : /usr/bin/node,/usr/bin/pm2,report
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz
cpus nb              : 4
freemem              : 6885416960
totalmem             : 8331403264
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬───────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name          │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼───────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ 4033524  │ 2D     │ 4    │ online    │ 0%       │ 115.7mb  │ root     │ disabled │
│ 1  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ 411245   │ 43h    │ 3    │ online    │ 0%       │ 116.8mb  │ root     │ disabled │
│ 2  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ 4033554  │ 2D     │ 1    │ online    │ 14.3%    │ 117.7mb  │ root     │ disabled │
│ 3  │ [REDACTED]    │ default     │ 0.2.0   │ fork    │ 1516     │ 5D     │ 0    │ online    │ 0%       │ 120.3mb  │ root     │ disabled │
│ 4  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ N/A      │ 0      │ 0    │ stopped   │ 0%       │ 0b       │ root     │ disabled │
│ 5  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ N/A      │ 0      │ 29   │ stopped   │ 0%       │ 0b       │ root     │ disabled │
│ 6  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ 1501051  │ 32m    │ 351  │ online    │ 0%       │ 173.6mb  │ root     │ disabled │
│ 7  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ N/A      │ 0      │ 0    │ stopped   │ 0%       │ 0b       │ root     │ disabled │
│ 8  │ [REDACTED]    │ default     │ 0.4.0   │ fork    │ N/A      │ 0      │ 240  │ stopped   │ 0%       │ 0b       │ root     │ disabled │
└────┴───────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2        | 2024-01-05T11:03:59: PM2 log: Stopping app:[REDACTED] id:6
PM2        | 2024-01-05T11:03:59: PM2 log: App [[REDACTED]:6] exited with code [0] via signal [SIGINT]
PM2        | 2024-01-05T11:03:59: PM2 log: pid=1436667 msg=process killed
PM2        | 2024-01-05T11:03:59: PM2 log: App [[REDACTED]:6] starting in -fork mode-
PM2        | 2024-01-05T11:03:59: PM2 log: App [[REDACTED]:6] online
PM2        | 2024-01-05T11:06:57: PM2 log: Stopping app:[REDACTED] id:6
PM2        | 2024-01-05T11:06:57: PM2 log: App [[REDACTED]:6] exited with code [0] via signal [SIGINT]
PM2        | 2024-01-05T11:06:57: PM2 log: pid=1456108 msg=process killed
PM2        | 2024-01-05T11:06:57: PM2 log: App [[REDACTED]:6] starting in -fork mode-
PM2        | 2024-01-05T11:06:57: PM2 log: App [[REDACTED]:6] online
PM2        | 2024-01-05T11:08:58: PM2 log: Stopping app:[REDACTED] id:6
PM2        | 2024-01-05T11:08:59: PM2 log: App [[REDACTED]:6] exited with code [0] via signal [SIGINT]
PM2        | 2024-01-05T11:08:59: PM2 log: pid=1471348 msg=process killed
PM2        | 2024-01-05T11:08:59: PM2 log: App [[REDACTED]:6] starting in -fork mode-
PM2        | 2024-01-05T11:08:59: PM2 log: App [[REDACTED]:6] online
PM2        | 2024-01-05T11:14:03: PM2 log: Stopping app:[REDACTED] id:6
PM2        | 2024-01-05T11:14:03: PM2 log: App [[REDACTED]:6] exited with code [0] via signal [SIGINT]
PM2        | 2024-01-05T11:14:03: PM2 log: pid=1486253 msg=process killed
PM2        | 2024-01-05T11:14:03: PM2 log: App [[REDACTED]:6] starting in -fork mode-
PM2        | 2024-01-05T11:14:03: PM2 log: App [[REDACTED]:6] online

kopacko avatar Jan 05 '24 17:01 kopacko

I have been getting this for a while now and only just figured out it was the multiple args... any interpreter, with a string or string array, more than one arg causes hang/errors

module.exports = {
    apps: [
        {
            name: "bug",
            port: 5431,
            instances: "4",
            script: "test.ts",
            interpreter: "node",
            exec_mode: "cluster",
	    interpreter_args: ["--env-file=.env.production","--smol"],
            env: {
            },
            env_production: {
                NITRO_PRESET: "node_cluster",
            }
        }
    ]
}

L422Y avatar Jan 08 '24 07:01 L422Y

I have been getting this for a while now and only just figured out it was the multiple args... any interpreter, with a string or string array, more than one arg causes hang/errors

module.exports = {
    apps: [
        {
            name: "bug",
            port: 5431,
            instances: "4",
            script: "test.ts",
            interpreter: "node",
            exec_mode: "cluster",
	    interpreter_args: ["--env-file=.env.production","--smol"],
            env: {
            },
            env_production: {
                NITRO_PRESET: "node_cluster",
            }
        }
    ]
}

So instead of a single string with multiple arguments, do comma separated values?

kopacko avatar Feb 10 '24 02:02 kopacko