Unitech / Unitech/pm2

PM2 stops watching after stop/start/restart [maybe bug?]

Open
#3,701 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

T: Bug
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

Please close this if duplicated: I tried to search but I did not find quite the same question.

I noticed the following.

  1. in my pm2.config.js I specify a watch array
module.exports = {
    name: 'tav-proxy',
    script: 'src/proxy.js',
    exec_mode: 'cluster',
    instances: isDevelopment ? 1 : 'max',
    node_args: '--harmony --trace-deprecation --experimental-modules --max_old_space_size=512',
    args: '--color',
    max_memory_restart: availableMem + 'M',
    max_restarts: 3,
    restart_delay: 3000,
    min_uptime: 3000,
    log_file: 'logs/proxy.log',
    log_date_format : 'YYYY-MM-DDTHH:mm:ssZ',
    watch: ['package.json', 'index.js', 'config/', 'src/', 'api/'],
    env_development: {
        NODE_ENV: 'development',
    },
    env_staging: {
        NODE_ENV: 'staging',
    },
    env_production: {
        NODE_ENV: 'production',
    }
};
  1. I start my process NODE_ENV=development HTTP_PORT=2999 HTTPS_PORT=3000 SOCKETS=localhost:3001 pm2 startOrRestart ./config/pm2-proxy.config.js --env development and I see the watching enabled from pm2 list

  2. I stop the process with pm2 stop <processname>

  3. I restart the process with pm2 start <processname>

  4. I see the watching disabled from pm2 list

PM2 report:

===============================================================================
--- PM2 REPORT (Fri Jun 08 2018 11:31:10 GMT+0200 (Central European Summer Time)) 
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 2.10.4
node version         : 10.4.0
node path            : /usr/local/bin/pm2
argv                 : /usr/local/Cellar/node/10.4.0/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : damiano
uid                  : 502
gid                  : 20
uptime               : 117min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 2.10.4
node version         : 10.4.0
node path            : /usr/local/bin/pm2
argv                 : /usr/local/Cellar/node/10.4.0/bin/node,/usr/local/bin/pm2,report
argv0                : node
user                 : damiano
uid                  : 502
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i5-7500 CPU @ 3.40GHz
cpus nb              : 4
freemem              : 716713984
totalmem             : 17179869184
home                 : /Users/damiano
===============================================================================
--- PM2 list -----------------------------------------------
┌─────────────────┬────┬─────────┬───────┬────────┬─────────┬────────┬─────┬───────────┬─────────┬──────────┐
│ App name        │ id │ mode    │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user    │ watching │
├─────────────────┼────┼─────────┼───────┼────────┼─────────┼────────┼─────┼───────────┼─────────┼──────────┤
│ tav-proxy       │ 0  │ cluster │ 42920 │ online │ 4       │ 2m     │ 0%  │ 29.5 MB   │ damiano │ enabled  │
│ tav-socket-3001 │ 1  │ cluster │ 42856 │ online │ 2       │ 2m     │ 0%  │ 27.9 MB   │ damiano │ disabled │
└─────────────────┴────┴─────────┴───────┴────────┴─────────┴────────┴─────┴───────────┴─────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/damiano/.pm2/pm2.log last 20 lines:
PM2        | [2018-06-08 11:28:21] PM2 log: pid=42790 msg=process killed
PM2        | [2018-06-08 11:28:21] PM2 error: Change detected on path logs/socket-1.log for app tav-proxy - restarting
PM2        | [2018-06-08 11:28:21] PM2 log: Stopping app:tav-proxy id:0
PM2        | [2018-06-08 11:28:21] PM2 log: App name:tav-proxy id:0 disconnected
PM2        | [2018-06-08 11:28:21] PM2 log: App [tav-proxy] with id [0] and pid [42768], exited with code [0] via signal [SIGINT]
PM2        | [2018-06-08 11:28:21] PM2 log: pid=42768 msg=process killed
PM2        | [2018-06-08 11:28:21] PM2 log: Starting execution sequence in -cluster mode- for app name:tav-proxy id:0
PM2        | [2018-06-08 11:28:21] PM2 log: App name:tav-proxy id:0 online
PM2        | (node:42833) ExperimentalWarning: The ESM module loader is experimental.
PM2        | [2018-06-08 11:28:25] PM2 log: Starting execution sequence in -cluster mode- for app name:tav-socket-3001 id:1
PM2        | [2018-06-08 11:28:25] PM2 log: App name:tav-socket-3001 id:1 online
PM2        | (node:42856) ExperimentalWarning: The ESM module loader is experimental.
PM2        | [2018-06-08 11:28:36] PM2 error: Change detected on path package.json for app tav-proxy - restarting
PM2        | [2018-06-08 11:28:36] PM2 log: Stopping app:tav-proxy id:0
PM2        | [2018-06-08 11:28:36] PM2 log: App name:tav-proxy id:0 disconnected
PM2        | [2018-06-08 11:28:36] PM2 log: App [tav-proxy] with id [0] and pid [42833], exited with code [0] via signal [SIGINT]
PM2        | [2018-06-08 11:28:36] PM2 log: pid=42833 msg=process killed
PM2        | [2018-06-08 11:28:36] PM2 log: Starting execution sequence in -cluster mode- for app name:tav-proxy id:0
PM2        | [2018-06-08 11:28:36] PM2 log: App name:tav-proxy id:0 online
PM2        | (node:42920) ExperimentalWarning: The ESM module loader is experimental.

Please copy/paste the above report in your issue on https://github.com/Unitech/pm2/issues

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the sequence from the PM2 configuration: run startOrRestart, stop the process, then start it again, and compare the watching state shown by pm2 list. Use the supplied PM2 report and daemon log as diagnostic context. Done means the configured watch array remains enabled after stop/start and restart operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.