mozilla / fxa-local-dev

An easy way to contribute to Firefox Accounts
28 stars 47 forks source link

pm2 kill doesn't stop neither fxa-content-server nor syncserver #65

Closed jua-mp closed 8 years ago

jua-mp commented 8 years ago

After running ./pm2 kill I always have to kill two process manually.

Here the output of ps ax after running ./pm2 kill

7683 ?        Sl     0:00 /home/fxa/fxa-local-dev/syncserver/local/bin/python2 ./local/bin/pserve ../_scripts/syncserver.ini
8204 ?        Sl     0:01 node /home/fxa/fxa-local-dev/fxa-content-server/server/bin/fxa-content-server.js`

This is just slightly annoying so it is not a big issue. It nevertheless causes the syncserver to fail while starting again, as there is already a server listening on the socket when it tries to bind to it.

Also, I am not sure of this should be filed against pm2 directly or if it has to do with how the processes are set up in the first place.

Possibly useful information:

Anyway, thank you very much! :smile:

vladikoff commented 8 years ago

yea we should wrap the sync server into a killable node script.

However I cannot reproduce this for the content server

shane-tomlinson commented 8 years ago

However I cannot reproduce this for the content server

I can, 99% of the time. 1% of the time it works.

shane-tomlinson commented 8 years ago

However I cannot reproduce this for the content server

I've gone so far as to create this script to restart the content server:

#!/bin/bash

NODE_PID=`ps ax | grep node | grep fxa-content-server | awk '{print $1}'`
kill "${NODE_PID}"
jua-mp commented 8 years ago

However I cannot reproduce this for the content server

I have been using a script that kills both processes for a long time, so I cannot really tell how often it happens, although I did have the feeling that it was all the time.

I've gone so far as to create this script to restart the content server:

I had one too, but it was far less elegant than yours and would mercilessly kill all my node processes:

#!/bin/bash

pkill -f fxa-content-server.js

I'll certainly start using yours :+1:

vbudhram commented 8 years ago

@jua-mp I was having a similar issue, but upgrading to pm2 1.1.3 seemed to fix it for me.

jua-mp commented 8 years ago

@vbudhram Thank you very much!

Nonetheless, it is explicitly defined as "pm2": "0.15.10" in the fxa-local-dev/package.json

Does anybody know if there is a reason for this?

philbooth commented 8 years ago

@philbooth NOTE TO SELF, do what Vijay did