YAML / JSON difference in watch behaviour
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
Hello everyone. Thanks for your work.
What's going wrong?
When I use ecosystem.config.js it works ok.
apps : [
{
script: "app.js",
watch: true,
},
But when I switched to YAML(yeah, I know: "use JSON format if possible")
apps:
- script: app.js
watch: true
PM2 hangs one of my cores with 100% load and enormous writes to log file. In that log I found chokidar trying to watch all directory files (which I have millions)
I fix it changing watch: true to watch: app.js.
Just want to point to this inconsistency
How could we reproduce this issue?
#!/usr/bin/env bash
mkdir /tmp/test
cd /tmp/test
for i in {1..10000}; do touch $i; done
echo "apps:" > ecosystem.json
echo " - script: app.js" >> ecosystem.json
echo " - watch: true" >> ecosystem.json
echo 'console.log(1)' > app.js
pm2 start ecosystem.yaml
Supporting information
===============================================================================
--- PM2 REPORT (Mon Oct 02 2017 14:16:30 GMT+0300 (EEST)) ---------------------
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 2.7.1
node version : 8.6.0
node path : undefined
argv : /usr/local/bin/node,/usr/local/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : vganzin
uid : 1000
gid : 1000
uptime : 22min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 2.7.1
node version : 8.6.0
node path : undefined
argv : /usr/local/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : vganzin
uid : 1000
gid : 1000
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Pentium(R) CPU 4405U @ 2.10GHz
cpus nb : 4
freemem : 326893568
totalmem : 8344227840
home : /home/vganzin
===============================================================================
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 running the supplied reproduction around pm2 start ecosystem.yaml and compare it with the ecosystem.config.js example. Trace how the YAML configuration reaches chokidar's watch setup, using the reported watch: true and watch: app.js cases. Done means the two configuration formats have consistent watch behavior without scanning the entire directory.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100