title: PM2 throws errors w/ Express app port listener and phantomjs-node instance
body: <p>So I have an express app that is listening on <code>localhost:8888</code>, and if I run it in node, standalone, it listens just fine.  But when I try to run it using PM2, I get the errors below in the PM2 logs.</p>
  
  <pre><code>var
      phantom = require('phantom'),
      express = require('express'),
      serve = express();
  
  phantom.create(function(ph) {
      console.log('Phantom browser created.');
      serve.get('/foo', function (req, res) {
          res.json({foo: 'bar'});
          res.end();
      });
  
      serve.listen(8888);
  });
  </code></pre>
  
  <p><code>pm2 start -i 0 myserver.js</code></p>
  
  <p>PM2 shows that it starts 8 processes but then if I do <code>pm2 list</code> nothing is there.</p>
  
  <p>Looking in <code>pm2 logs</code> I see the errors in the log below.  BUT.. if I comment out the <code>serve.listen(8888);</code> line, it works JUST FINE.  What in the world am I doing wrong here??</p>
  
  <pre><code>PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:0
  PM2: 2015-05-27 17:16:14: App name:myserver id:0 online
  PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:1
  PM2: 2015-05-27 17:16:14: App name:myserver id:1 online
  PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:2
  PM2: 2015-05-27 17:16:14: App name:myserver id:2 online
  PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:3
  PM2: 2015-05-27 17:16:14: App name:myserver id:3 online
  PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:4
  PM2: 2015-05-27 17:16:14: App name:myserver id:4 online
  PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:5
  PM2: 2015-05-27 17:16:14: App name:myserver id:5 online
  PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:6
  PM2: 2015-05-27 17:16:14: App name:myserver id:6 online
  PM2: 2015-05-27 17:16:14: Starting execution sequence in -cluster mode- for app name:myserver id:7
  PM2: 2015-05-27 17:16:15: App name:myserver id:7 online
  myserver-1 (out): Phantom broswer created.
  myserver-3 (out): Phantom broswer created.
  myserver-5 (out): Phantom broswer created.
  myserver-1 (out): Phantom broswer created.
  PM2: 2015-05-27 17:16:17: [PM2] Error caught by domain:
  PM2: AssertionError: false == true
  PM2:     at RoundRobinHandle.add (cluster.js:140:3)
  PM2:     at queryServer (cluster.js:480:12)
  PM2:     at Worker.onmessage (cluster.js:438:7)
  PM2:     at ChildProcess.&lt;anonymous&gt; (cluster.js:692:8)
  PM2:     at ChildProcess.emit (events.js:129:20)
  PM2:     at handleMessage (child_process.js:324:10)
  PM2:     at Pipe.channel.onread (child_process.js:352:11)
  myserver-7 (out): Phantom broswer created.
  myserver-3 (out): Phantom broswer created.
  PM2: 2015-05-27 17:16:17: [PM2] Automatic `pm2 update` failed. Killing PM2 daemon and its processes...
  PM2: 2015-05-27 17:16:17: pm2 has been killed by signal, dumping process list before exit...
  PM2: 2015-05-27 17:16:17: Stopping app:myserver id:0
  PM2: 2015-05-27 17:16:17: App name:myserver id:0 disconnected
  myserver-5 (out): Phantom broswer created.
  PM2: assert.js:86
  PM2:   throw new assert.AssertionError({
  PM2:         ^
  PM2: AssertionError: false == true
  PM2:     at RoundRobinHandle.add (cluster.js:140:3)
  PM2:     at queryServer (cluster.js:480:12)
  PM2:     at Worker.onmessage (cluster.js:438:7)
  PM2:     at ChildProcess.&lt;anonymous&gt; (cluster.js:692:8)
  PM2:     at ChildProcess.emit (events.js:129:20)
  PM2:     at handleMessage (child_process.js:324:10)
  PM2:     at Pipe.channel.onread (child_process.js:352:11)
  myserver-0 (err): Process disconnected from parent !
  PM2: [PM2] Spawning PM2 daemon
  PM2: 2015-05-27 17:16:18: [PM2][WORKER] Started with refreshing interval: 30000
  PM2: 2015-05-27 17:16:18: [[[[ PM2/God daemon launched ]]]]
  PM2: 2015-05-27 17:16:18: BUS system [READY] on port /Users/matthewmarcus/.pm2/pub.sock
  PM2: 2015-05-27 17:16:18: RPC interface [READY] on port /Users/matthewmarcus/.pm2/rpc.sock
  PM2: [PM2] PM2 Successfully daemonized
  PM2: Be sure to have the latest version by doing `npm install pm2@latest -g` before doing this procedure.
  PM2: [PM2] Stopping PM2...
  PM2: [PM2][WARN] No process found
  PM2: [PM2] All processes have been stopped and deleted
  PM2: 2015-05-27 17:16:18: PM2 is being killed via kill method
  PM2: 2015-05-27 17:16:18: RPC socket closed
  PM2: 2015-05-27 17:16:18: PUB socket closed
  PM2: [PM2] PM2 stopped
  PM2: 2015-05-27 17:16:19: [PM2][WORKER] Started with refreshing interval: 30000
  PM2: 2015-05-27 17:16:19: [[[[ PM2/God daemon launched ]]]]
  PM2: 2015-05-27 17:16:19: BUS system [READY] on port /Users/matthewmarcus/.pm2/pub.sock
  PM2: 2015-05-27 17:16:19: RPC interface [READY] on port /Users/matthewmarcus/.pm2/rpc.sock
  PM2: &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; PM2 updated
  PM2: ┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬────────┬──────────┐
  PM2: │ App name │ id │ mode │ pid │ status │ restart │ uptime │ memory │ watching │
  PM2: └──────────┴────┴──────┴─────┴────────┴─────────┴────────┴────────┴──────────┘
  PM2:  Use `pm2 show &lt;id|name&gt;` to get more details about an app
  </code></pre>