Skip to content
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

Tiny oversight for development builds and pm2 report due to semver check (temp fix included) #3695

Closed
shikhir-arora opened this issue Jun 5, 2018 · 2 comments

Comments

@shikhir-arora
Copy link

What's going wrong?

Just a small oversight perhaps, in the development branch currently at 3.0.0-alpha1, pm2 report will throw a defined error:

[PM2][ERROR] You need to update your Daemon, please type $ pm2 update.

This is obviously not what we want to do and it won't change the result.

This is due to the semvar check here at line 111.


How could we reproduce this issue?

  • Install/upgrade to pm2@development (currently 3.0.0-alpha1) the normal way:

npm install Unitech/pm2#development -g; pm2 update

  • Run pm2 report after verifying with pm2 --version that your version is the development/alpha build.

  • The error described above will occur.

Temporary Fix

I just fixed this quickly by changing the check on the above mentioned line to the following, which will parse out the build and is valid for any build that would be checked. The only case where it would return true where you may want it to return false is if someone used 2.6.0-alpha or any -prerelease of 2.6.0. That's very unlikely, and even if they were running that, it would fail anyways as it's still the same issue with the semver format.

Current snippet:

if (semver.satisfies(data, '>= 2.6.0'))

Changed to the following to fix:

if (semver.satisfies(semver.coerce(data), '>=2.6.0'))

You probably don't need this, but I will follow the guideline (I did get pm2 report working, as mentioned above).

If this is intentional, I apologize. I looked around and didn't see any other complaints about it on the issues tracker/Git blame, so I thought I'd bring it up since pm2 report seems like it'd have use on development builds for actual issues. 🙂

Supporting information

===============================================================================
--- PM2 REPORT (Mon Jun 04 2018 22:02:48 GMT-0700 (PDT)) ----------------------
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.0.0-alpha1
node version         : 10.3.0
node path            : /home/vlexar/.nvm/versions/node/v10.3.0/bin/pm2
argv                 : /home/vlexar/.nvm/versions/node/v10.3.0/bin/node,/home/vlexar/.nvm/versions/node/v10.3.0/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : vlexar
uid                  : 1000
gid                  : 1000
uptime               : 4min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 3.0.0-alpha1
node version         : 10.3.0
node path            : /home/vlexar/.nvm/versions/node/v10.3.0/bin/pm2
argv                 : /home/vlexar/.nvm/versions/node/v10.3.0/bin/node,/home/vlexar/.nvm/versions/node/v10.3.0/bin/pm2,report
argv0                : node
user                 : vlexar
uid                  : 1000
gid                  : 1000
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : linux
type                 : Linux
cpus                 : Intel(R) Xeon(R) CPU E3-1270 v6 @ 3.80GHz
cpus nb              : 8
freemem              : 9438666752
totalmem             : 33366151168
home                 : /home/vlexar
===============================================================================
--- PM2 list -----------------------------------------------
┌────────────────┬────┬──────┬───────┬────────┬─────────┬────────┬─────────┬────────────┬────────┬──────────┐
│ App name       │ id │ mode │ pid   │ status │ restart │ uptime │ cpu     │ mem        │ user   │ watching │
├────────────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────────┼────────────┼────────┼──────────┤
│ karmabot-2.0.0 │ 1  │ fork │ 23749 │ online │ 0       │ 4m     │ 0.975%  │ 156.0 MB   │ vlexar │ disabled │
│ lavalink.js    │ 0  │ fork │ 23742 │ online │ 0       │ 4m     │ 0.0125% │ 43.5 MB    │ vlexar │ disabled │
└────────────────┴────┴──────┴───────┴────────┴─────────┴────────┴─────────┴────────────┴────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/vlexar/.pm2/pm2.log last 20 lines:
PM2        | [2018-06-04 21:50:56] PM2 log: PM2 successfully stopped
PM2        | [2018-06-04 21:58:04] PM2 log: ===============================================================================
PM2        | [2018-06-04 21:58:04] PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2        | [2018-06-04 21:58:04] PM2 log: Time                 : Mon Jun 04 2018 21:58:04 GMT-0700 (PDT)
PM2        | [2018-06-04 21:58:04] PM2 log: PM2 version          : 3.0.0-alpha1
PM2        | [2018-06-04 21:58:04] PM2 log: Node.js version      : 10.3.0
PM2        | [2018-06-04 21:58:04] PM2 log: Current arch         : x64
PM2        | [2018-06-04 21:58:04] PM2 log: PM2 home             : /home/vlexar/.pm2
PM2        | [2018-06-04 21:58:04] PM2 log: PM2 PID file         : /home/vlexar/.pm2/pm2.pid
PM2        | [2018-06-04 21:58:04] PM2 log: RPC socket file      : /home/vlexar/.pm2/rpc.sock
PM2        | [2018-06-04 21:58:04] PM2 log: BUS socket file      : /home/vlexar/.pm2/pub.sock
PM2        | [2018-06-04 21:58:04] PM2 log: Application log path : /home/vlexar/.pm2/logs
PM2        | [2018-06-04 21:58:04] PM2 log: Process dump file    : /home/vlexar/.pm2/dump.pm2
PM2        | [2018-06-04 21:58:04] PM2 log: Concurrent actions   : 2
PM2        | [2018-06-04 21:58:04] PM2 log: SIGTERM timeout      : 1600
PM2        | [2018-06-04 21:58:04] PM2 log: ===============================================================================
PM2        | [2018-06-04 21:58:11] PM2 log: Starting execution sequence in -fork mode- for app name:lavalink.js id:0
PM2        | [2018-06-04 21:58:11] PM2 log: Starting execution sequence in -fork mode- for app name:karmabot-2.0.0 id:1
PM2        | [2018-06-04 21:58:11] PM2 log: App name:lavalink.js id:0 online
PM2        | [2018-06-04 21:58:11] PM2 log: App name:karmabot-2.0.0 id:1 online
@shikhir-arora shikhir-arora changed the title Tiny oversight for development builds and pm2 report due to semvar check (temp fix included) Tiny oversight for development builds and pm2 report due to semver check (temp fix included) Jun 5, 2018
@wallet77
Copy link
Contributor

wallet77 commented Jun 7, 2018

Hi @shikhir-arora

Good catch.
Indeed it's not critical because it happens only with version containing alpha.
But I will fix it anyway.

wallet77 added a commit that referenced this issue Jun 7, 2018
@shikhir-arora
Copy link
Author

No problem, I figured it was worth noting because development builds could be prone to more 'need' of the pm2 report feature.

@wallet77 wallet77 mentioned this issue Jun 7, 2018
wallet77 added a commit that referenced this issue Jun 7, 2018
inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
inerc pushed a commit to inerc/pm2 that referenced this issue Feb 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants