Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pm2 spawning lots of 'git status -s' processes #924

Closed
Synchro opened this issue Jan 6, 2015 · 10 comments
Closed

pm2 spawning lots of 'git status -s' processes #924

Synchro opened this issue Jan 6, 2015 · 10 comments

Comments

@Synchro
Copy link

Synchro commented Jan 6, 2015

After starting my app successfully inside vagrant with pm2, I have a problem with pm2 spawning lots of status processes:

 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
 /bin/sh -c cd '/var/www/www.example.com/';LC_ALL=en_US.UTF-8 git status -s
 └─ git status -s
...

It spawns a few of these per second until it just starts to bog down - after half an hour there are nearly a thousand of these processes. If I run the git command manually it takes about 5 sec to run but completes successfully; pm2 should not fork-bomb like this just because it's slow!

@jshkurti
Copy link
Contributor

jshkurti commented Jan 6, 2015

Which version of pm2 and Node.js are you using ?
Can you :
npm install git://github.com/Unitech/pm2#hotfix -g
and show me the output of pm2 logs while you start your process in parallel ?

Thanks

@Synchro
Copy link
Author

Synchro commented Jan 8, 2015

I'm running PM2 0.12.3 and node 0.10.35. I tried with the hotfix version, got the same result.

I think my app isn't actually launching correctly, so PM2 keeps relaunching it, and triggers a git check every time. So, while I clearly need to get the app working properly (I'm just setting up the env, someone else is writing the app), it would be better if PM2 could avoid this issue.

@soyuka
Copy link
Collaborator

soyuka commented Jan 8, 2015

Restarting after a failure is the whole point of pm2. Why don't you node my-app.js while you're not sure it's working fine?

You may also play with max_restarts or things like this but it won't fix your issue (https://github.com/Unitech/PM2/blob/master/ADVANCED_README.md#schema).

@jshkurti
Copy link
Contributor

jshkurti commented Jan 8, 2015

Can you please show us pm2 logs ?
Either by typing pm2 logs while launching your app or tail -n 1000 ~/.pm2/pm2.log

@Unitech
Copy link
Owner

Unitech commented Jan 8, 2015

@Synchro your app is constantly relaunched ? More than 15 times ?

@Synchro
Copy link
Author

Synchro commented Jan 8, 2015

Yes, it was doing it thousands of times. I've now traced the problem to a missing npm package and now pm2 launches it ok. I can see it launch the git status, but it only does it once.

The pm2 side of the problem was that the app died instantly, but git status took much longer, resulting in overlapping launches, causing a gradual build up of processes.

@Unitech
Copy link
Owner

Unitech commented Jan 8, 2015

Gotcha, thanks for your feedback, we are working on it

We have to cancel git analysis on process exited.
https://github.com/Unitech/PM2/blob/master/lib/God.js#L412

@jshkurti
Copy link
Contributor

jshkurti commented Jan 9, 2015

0e798b1

@joshribakoff
Copy link

This happens for me still, using 2.9.1, not only does it call "git status" tons of times, but it also calls "npm" command with seemingly no arguments. I run pm2 inside a vagrant box, where git status is extra slow. It basically bricks the whole vagrant box & I have to destroy the VM & rebuild it. Maybe I'm missing something, but I don't see any reason why my process manager should need to call my version control system & my package manager at all? All I want my process manager to do is manage my process. How do I disable this?

@tim-kos
Copy link

tim-kos commented Mar 13, 2019

+1

I also have this very problem with the recent pm2 version as described by @joshribakoff .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants