pm2 restart command ignores saved `windowsHide` process setting
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?
If starting a process with an ecosystem file that has windowsHide set to false, restarting that process via pm2 restart <name> restarts the process with windowsHide set to true.
If the master pm2 process restarts from scratch and loads a saved process that has windowsHide set to false, the setting works as expected.
How could we reproduce this issue?
Start a new process with windowsHide set to false, confirming the window is showing. Restart the process with pm2 restart <name>, and confirm the window is now hidden. The process's env has windowsHide set to true, which you can confirm with a tool like Process Explorer.
Supporting information
My ecosystem file:
module.exports = {
apps : [{
name: 'sync',
script: 'Sync.exe',
instances: 1,
autorestart: true,
windowsHide: false,
watch: false,
max_memory_restart: '1G'
}]
};
--- PM2 report ----------------------------------------------------------------
Date : Fri Dec 13 2019 10:37:44 GMT-0500 (Eastern Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.1.2
node version : 10.17.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A
uptime : 9min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.1.2
node version : 10.17.0
node path : not found
argv : C:\Program Files\nodejs\node.exe,C:\Users\Administrator\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0 : node
user : Administrator
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT
cpus : Intel(R) Core(TM) i7-8700T CPU @ 2.40GHz
cpus nb : 12
freemem : 30745886720
totalmem : 34190544896
home : C:\Users\Administrator
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬─────────────────────────┬─────────┬─────────┬──────────┬────────┬──────┬──────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├────┼─────────────────────────┼─────────┼─────────┼──────────┼────────┼──────┼──────────┼──────────┼──────────┼──────────┼──────────┤
│ 2 │ sync │ N/A │ fork │ 11060 │ 9m │ 0 │ online │ 0% │ 74.1mb │ Adm… │ disabled │
└────┴─────────────────────────┴─────────┴─────────┴──────────┴────────┴──────┴──────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
C:\Users\Administrator\.pm2\pm2.log last 20 lines:
PM2 | 2019-12-13T10:28:33: PM2 log: Time : Fri Dec 13 2019 10:28:33 GMT-0500 (Eastern Standard Time)
PM2 | 2019-12-13T10:28:33: PM2 log: PM2 version : 4.1.2
PM2 | 2019-12-13T10:28:33: PM2 log: Node.js version : 10.17.0
PM2 | 2019-12-13T10:28:33: PM2 log: Current arch : x64
PM2 | 2019-12-13T10:28:33: PM2 log: PM2 home : C:\Users\Administrator\.pm2
PM2 | 2019-12-13T10:28:33: PM2 log: PM2 PID file : C:\Users\Administrator\.pm2\pm2.pid
PM2 | 2019-12-13T10:28:33: PM2 log: RPC socket file : \\.\pipe\rpc.sock
PM2 | 2019-12-13T10:28:33: PM2 log: BUS socket file : \\.\pipe\pub.sock
PM2 | 2019-12-13T10:28:33: PM2 log: Application log path : C:\Users\Administrator\.pm2\logs
PM2 | 2019-12-13T10:28:33: PM2 log: Process dump file : C:\Users\Administrator\.pm2\dump.pm2
PM2 | 2019-12-13T10:28:33: PM2 log: Concurrent actions : 2
PM2 | 2019-12-13T10:28:33: PM2 log: SIGTERM timeout : 1600
PM2 | 2019-12-13T10:28:33: PM2 log: ===============================================================================
PM2 | 2019-12-13T10:28:34: PM2 log: App [sync:2] starting in -fork mode-
PM2 | 2019-12-13T10:28:34: PM2 log: App [sync:2] online
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how pm2 restart <name> reconstructs a process from its saved ecosystem configuration, focusing on where windowsHide is applied. Reproduce the Windows case with windowsHide: false, then verify that restarting preserves the setting and that a saved-process reload still behaves consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100