Skip to content

pm2 reload app1 app2 silently ignores every name after the first #6132

Description

@MuhammadFarhantahir

Bug

pm2 reload a b only reloads a. b is silently dropped — no warning, and the process keeps running old code. We hit this in production (6.x): pm2 reload api worker after a deploy left worker on the previous build. Code path is unchanged on master and development.

Cause

stop and restart are declared variadic in lib/binaries/CLI.js, but reload is not:

commander.command('stop <id|name|namespace|all|json|stdin...>')      // variadic
commander.command('restart <id|name|namespace|all|json|stdin...>')  // variadic
commander.command('reload <id|name|namespace|all>')                 // NOT variadic — extra names dropped by commander

So commander parses only the first name and discards the rest. Consistent with that, test/e2e/cli/multiparam.sh exercises multi-name restart/stop/delete but has no reload case.

Fix

Make reload variadic and iterate with the same forEachLimit pattern restart uses (reload's internal lock makes sequential iteration the right shape). PR incoming, including a multi-name reload case in the multiparam e2e.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions