New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node_args are not passed to the node with pm2-docker #3257

Closed
vmarchaud opened this Issue Nov 4, 2017 · 9 comments

Comments

5 participants
@vmarchaud
Collaborator

vmarchaud commented Nov 4, 2017

I'm trying to enable remote debugging on my container but docker-pm2 is not passing the interpreter args to the interpreter:

/app # pm2 show ux
 Describing process with id 0 - name ux
┌───────────────────┬──────────────────────────┬──────────────┐
│ status            │ online                   │
│ name              │ ux                       │
│ restarts          │ 0                        │
│ uptime            │ 6m                       │
│ script path       │ /opt/ux/index.js         │
│ script args       │ N/A                      │
│ error log path    │ /dev/stderr              │
│ out log path      │ /dev/stdout              │
│ pid path          │ /tmp/ux_pm2-0.pid        │
│ interpreter       │ node                     │
│ interpreter args  │ --inspect                │ --debug=5859 │
│ script id         │ 0                        │
│ exec cwd          │ /app                     │
│ exec mode         │ cluster_mode             │
│ node.js version   │ 9.0.0                    │
│ watch & reload    │ ✘                        │
│ unstable restarts │ 0                        │
│ created at        │ 2017-11-04T16:31:14.627Z │
└───────────────────┴──────────────────────────┴──────────────┘
 Code metrics value
┌────────────┬─────────┐
│ Loop delay │ 27.81ms │
└────────────┴─────────┘
 Add your own code metrics: http://bit.ly/code-metrics
 Use `pm2 logs ux [--lines 1000]` to display logs
 Use `pm2 monit` to monitor CPU and Memory usage ux
/app # pm2 monit
/app # ps
PID   USER     TIME   COMMAND
    1 root       0:01 node /usr/local/bin/pm2-docker start /opt/pm2.json
   22 root       0:01 PM2 v2.7.2: God Daemon (/root/.pm2)
   28 root       0:04 node /opt/ux/index.js
   48 root       0:00 /bin/sh
   84 root       0:00 ps

as you can see on the output of ps, node is not getting the extra args.

@luisdavim

This comment has been minimized.

Show comment
Hide comment
@luisdavim

luisdavim Nov 5, 2017

I'm trying to use docker to create a cross platform local dev environment and this prevents me from using it for debugging.

luisdavim commented Nov 5, 2017

I'm trying to use docker to create a cross platform local dev environment and this prevents me from using it for debugging.

@luisdavim

This comment has been minimized.

Show comment
Hide comment
@luisdavim

luisdavim Dec 4, 2017

hi, any news about this?

luisdavim commented Dec 4, 2017

hi, any news about this?

@luisdavim

This comment has been minimized.

Show comment
Hide comment
@luisdavim

luisdavim Dec 5, 2017

Hi, I've investigated this issue a bit more and the problem doesn't seem to be exclusive to pm2-docker, I'm using the same docker container image (keymetrics/pm2 latest 695685bbe71b 2 days ago 89.8MB) but I've overdid the docke command to use pm2 instead of pm2-docker (CMD [ "pm2", "start", "--no-daemon", "/opt/pm2.json" ]
) and I see the same issue there:

/app # ps faux
PID   USER     TIME   COMMAND
    1 root       0:01 node /usr/local/bin/pm2 start --no-daemon /opt/pm2.json
   23 root       0:06 node /opt/ux/index.js
   53 root       0:00 /bin/sh
   59 root       0:00 ps faux
/app # pm2 --version
2.8.0
/app # pm2-docker --version
2.8.0
/app # cat /opt/pm2.json
{
  "apps": [{
    "name": "ux",
    "script": "/opt/ux/index.js",
    "log_date_format": "YYYY-MM-DD HH:mm Z",
    "pid_file": "/tmp/ux_pm2.pid",
    "error_file": "/dev/stderr",
    "out_file": "/dev/stdout",
    "instances": 1,
    "node_args": ["--inspect", "--debug=5859"],
    "exec_mode": "cluster"
  }]
}
/app # pm2 show ux
 Describing process with id 0 - name ux
┌───────────────────┬──────────────────────────┬──────────────┐
│ status            │ online                   │
│ name              │ ux                       │
│ restarts          │ 0                        │
│ uptime            │ 2m                       │
│ script path       │ /opt/ux/index.js         │
│ script args       │ N/A                      │
│ error log path    │ /dev/stderr              │
│ out log path      │ /dev/stdout              │
│ pid path          │ /tmp/ux_pm2-0.pid        │
│ interpreter       │ node                     │
│ interpreter args  │ --inspect                │ --debug=5859 │
│ script id         │ 0                        │
│ exec cwd          │ /app                     │
│ exec mode         │ cluster_mode             │
│ node.js version   │ 9.2.0                    │
│ watch & reload    │ ✘                        │
│ unstable restarts │ 0                        │
│ created at        │ 2017-12-05T13:09:54.101Z │
└───────────────────┴──────────────────────────┴──────────────┘
 Code metrics value
┌────────────┬──────────┐
│ Loop delay │ 123.36ms │
└────────────┴──────────┘
 Add your own code metrics: http://bit.ly/code-metrics
 Use `pm2 logs ux [--lines 1000]` to display logs
 Use `pm2 monit` to monitor CPU and Memory usage ux

luisdavim commented Dec 5, 2017

Hi, I've investigated this issue a bit more and the problem doesn't seem to be exclusive to pm2-docker, I'm using the same docker container image (keymetrics/pm2 latest 695685bbe71b 2 days ago 89.8MB) but I've overdid the docke command to use pm2 instead of pm2-docker (CMD [ "pm2", "start", "--no-daemon", "/opt/pm2.json" ]
) and I see the same issue there:

/app # ps faux
PID   USER     TIME   COMMAND
    1 root       0:01 node /usr/local/bin/pm2 start --no-daemon /opt/pm2.json
   23 root       0:06 node /opt/ux/index.js
   53 root       0:00 /bin/sh
   59 root       0:00 ps faux
/app # pm2 --version
2.8.0
/app # pm2-docker --version
2.8.0
/app # cat /opt/pm2.json
{
  "apps": [{
    "name": "ux",
    "script": "/opt/ux/index.js",
    "log_date_format": "YYYY-MM-DD HH:mm Z",
    "pid_file": "/tmp/ux_pm2.pid",
    "error_file": "/dev/stderr",
    "out_file": "/dev/stdout",
    "instances": 1,
    "node_args": ["--inspect", "--debug=5859"],
    "exec_mode": "cluster"
  }]
}
/app # pm2 show ux
 Describing process with id 0 - name ux
┌───────────────────┬──────────────────────────┬──────────────┐
│ status            │ online                   │
│ name              │ ux                       │
│ restarts          │ 0                        │
│ uptime            │ 2m                       │
│ script path       │ /opt/ux/index.js         │
│ script args       │ N/A                      │
│ error log path    │ /dev/stderr              │
│ out log path      │ /dev/stdout              │
│ pid path          │ /tmp/ux_pm2-0.pid        │
│ interpreter       │ node                     │
│ interpreter args  │ --inspect                │ --debug=5859 │
│ script id         │ 0                        │
│ exec cwd          │ /app                     │
│ exec mode         │ cluster_mode             │
│ node.js version   │ 9.2.0                    │
│ watch & reload    │ ✘                        │
│ unstable restarts │ 0                        │
│ created at        │ 2017-12-05T13:09:54.101Z │
└───────────────────┴──────────────────────────┴──────────────┘
 Code metrics value
┌────────────┬──────────┐
│ Loop delay │ 123.36ms │
└────────────┴──────────┘
 Add your own code metrics: http://bit.ly/code-metrics
 Use `pm2 logs ux [--lines 1000]` to display logs
 Use `pm2 monit` to monitor CPU and Memory usage ux
@luisdavim

This comment has been minimized.

Show comment
Hide comment
@luisdavim

luisdavim Dec 5, 2017

this seems to be working with PM2 version 2.7.2 without docker.

luisdavim commented Dec 5, 2017

this seems to be working with PM2 version 2.7.2 without docker.

@luisdavim

This comment has been minimized.

Show comment
Hide comment
@luisdavim

luisdavim Dec 5, 2017

@vmarchaud maybe we should update the issue title since this is not affecting pm2-docker only.

luisdavim commented Dec 5, 2017

@vmarchaud maybe we should update the issue title since this is not affecting pm2-docker only.

@luisdavim

This comment has been minimized.

Show comment
Hide comment
@luisdavim

luisdavim Dec 5, 2017

tested with "exec_mode": "fork" and I still have the same issue:

{
  "apps": [{
    "name": "ux",
    "script": "/opt/ux/index.js",
    "log_date_format": "YYYY-MM-DD HH:mm Z",
    "pid_file": "/tmp/ux_pm2.pid",
    "error_file": "/dev/stderr",
    "out_file": "/dev/stdout",
    "instances": 1,
    "node_args": ["--inspect", "--debug=5859"],
    "exec_mode": "fork"
  }]
}

luisdavim commented Dec 5, 2017

tested with "exec_mode": "fork" and I still have the same issue:

{
  "apps": [{
    "name": "ux",
    "script": "/opt/ux/index.js",
    "log_date_format": "YYYY-MM-DD HH:mm Z",
    "pid_file": "/tmp/ux_pm2.pid",
    "error_file": "/dev/stderr",
    "out_file": "/dev/stdout",
    "instances": 1,
    "node_args": ["--inspect", "--debug=5859"],
    "exec_mode": "fork"
  }]
}
@nagy-tamas

This comment has been minimized.

Show comment
Hide comment
@nagy-tamas

nagy-tamas Dec 6, 2017

this worked for me with node8:

instances: 1
exec_mode: fork
node_args: [ "--inspect=0.0.0.0:9229" ]

of course, you also need to open port 9229 on the container (-p 9229:9229)

nagy-tamas commented Dec 6, 2017

this worked for me with node8:

instances: 1
exec_mode: fork
node_args: [ "--inspect=0.0.0.0:9229" ]

of course, you also need to open port 9229 on the container (-p 9229:9229)

Unitech added a commit that referenced this issue Feb 2, 2018

@Unitech

This comment has been minimized.

Show comment
Hide comment
@Unitech

Unitech Feb 2, 2018

Owner

pending release

Owner

Unitech commented Feb 2, 2018

pending release

@wallet77

This comment has been minimized.

Show comment
Hide comment
@wallet77

wallet77 Feb 20, 2018

Collaborator

PM2 2.10.1 has been release:

$ npm install pm2@latest -g
$ pm2 update
Collaborator

wallet77 commented Feb 20, 2018

PM2 2.10.1 has been release:

$ npm install pm2@latest -g
$ pm2 update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment