Unitech / Unitech/pm2

Disable cron-restart not working

Open
#5,491 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

pm2 v4.5.6
node.js v14.16.1

I'm trying to disable cron-restart using this command (as mentioned here: https://pm2.keymetrics.io/docs/usage/restart-strategies/) but is not working

pm2 restart app --cron-restart 0

I got this error:

Use --update-env to update environment variables
[PM2] cron restart at 0
/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/lib/API.js:1611
      delete appConf.args;
      ^

TypeError: Cannot convert undefined or null to object
    at API._handleAttributeUpdate (/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/lib/API.js:1611:7)
    at API._operate (/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/lib/API.js:1328:19)
    at API.restart (/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/lib/API.js:521:12)
    at /home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/lib/binaries/CLI.js:373:11
    at /home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/node_modules/async/internal/withoutIndex.js:8:40
    at replenish (/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:81:17)
    at /home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/node_modules/async/internal/eachOfLimit.js:86:9
    at eachLimit (/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/node_modules/async/forEachLimit.js:47:43)
    at awaitable (/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/node_modules/async/internal/awaitify.js:13:28)
    at Command.<anonymous> (/home/ubuntu/.nvm/versions/node/v14.16.1/lib/node_modules/pm2/lib/binaries/CLI.js:372:5)

Am I doing something wrong? How can I disable con-restart?

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 by reproducing pm2 restart app --cron-restart 0 on the reported restart path, then inspect lib/API.js around line 1611 and the callers in lib/API.js and lib/binaries/CLI.js shown in the stack trace. Done means disabling cron restarts no longer throws TypeError: Cannot convert undefined or null to object and the command completes successfully.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.