Unitech / Unitech/pm2

Error in /root/.pm2/module_conf.json

Open
#3,039 1 comment 0 reactions 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

What's going wrong?

When adding pm2 set commands, it sometimes corrupts the $home/.pm2/module_conf.json. I think this might be due to me running the pm2 set in the background?? I originally did it that way because it occasionally took a very long time to run that setting.

How could we reproduce this issue?

Install script:
#PM2

echo "Installing PM2"
npm install -g pm2
pm2 install pm2-logrotate  #rotates logs
pm2 set pm2-logrotate:compress true & #compress rotated logs .. run in background
pm2 set pm2-logrotate:retain 14
echo "Done Installing PM2"
## Supporting information

And the config file after (see the extra closing bracket)

{
    "pm2-logrotate": {
        "max_size": "10M",
        "retain": "14",
        "compress": false,
        "dateFormat": "YYYY-MM-DD_HH-mm-ss",
        "workerInterval": "30",
        "rotateInterval": "0 0 * * *",
        "rotateModule": true
    },
    "module-db": {
        "pm2-logrotate": {
            "uid": null,
            "gid": null
        }
    }
}
}

Please run the following command (available on PM2 >= 2.6)

$ pm2 report
===============================================================================
--- PM2 REPORT (Thu Jul 20 2017 16:04:52 GMT+0000 (UTC)) ----------------------
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 2.6.1
node version         : 6.9.4
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : root
uid                  : 0
gid                  : 0
uptime               : 24min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 2.6.1
node version         : 6.9.4
node path            : /usr/local/bin/pm2
argv                 : /usr/local/bin/node,/usr/local/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-2676 v3 @ 2.40GHz
cpus nb              : 1
freemem              : 1126121472
totalmem             : 2095661056
home                 : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌───────────────────┬────┬─────────┬──────┬────────┬─────────┬────────┬─────┬────────────┬──────┬──────────┐
│ App name          │ id │ mode    │ pid  │ status │ restart │ uptime │ cpu │ mem        │ user │ watching │
├───────────────────┼────┼─────────┼──────┼────────┼─────────┼────────┼─────┼────────────┼──────┼──────────┤
│ xen-integrity-app │ 1  │ cluster │ 6782 │ online │ 0       │ 8m     │ 0%  │ 111.9 MB   │ root │ disabled │
│ xen-integrity-app │ 2  │ cluster │ 6804 │ online │ 0       │ 8m     │ 0%  │ 111.7 MB   │ root │ disabled │
│ xen-integrity-app │ 3  │ cluster │ 6832 │ online │ 0       │ 8m     │ 0%  │ 108.2 MB   │ root │ disabled │
│ xen-integrity-app │ 4  │ cluster │ 6860 │ online │ 0       │ 8m     │ 0%  │ 111.5 MB   │ root │ disabled │
│ xen-integrity-mas │ 0  │ fork    │ 6774 │ online │ 0       │ 8m     │ 0%  │ 97.9 MB    │ root │ disabled │
└───────────────────┴────┴─────────┴──────┴────────┴─────────┴────────┴─────┴────────────┴──────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------

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

Start with the pm2 set command and the /root/.pm2/module_conf.json path, reproducing the two settings being run concurrently or in the background. Trace how settings are written and verify that repeated or overlapping commands leave valid JSON without losing configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.