Unitech / Unitech/pm2

PM2 API restart and reload ignore snake case options

Open
#5,292 0 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

What's going wrong?

PM2 API restart and reload seem to ignore the snake case options.
But the camel case is effective.

In this case (snake case), PM2 ignores listen_timeout option.

pm2.restart(proc_name,
        {
            listen_timeout: 20000
        },

On the other hand, following case (camel case), it is effective.

pm2.restart(proc_name,
         {
             listenTimeout: 20000
         },

I inspect the API code and I find that Config.filterOptions called from restart and reload seems to block snake case options.
It passes only alias key and ignores original key.
https://github.com/Unitech/pm2/blob/cef1c9e0d029ac8310694652a7fcb1d221da4afd/lib/tools/Config.js#L58-L75

Supporting information

It occurs on PM2 5.1.2

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 in lib/tools/Config.js at the filterOptions code linked in the issue, then trace how PM2 API restart and reload process their options. Reproduce the listen_timeout case against PM2 5.1.2 and verify that snake_case options are accepted as effectively as camelCase options.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.