title: nodejs cluster module - Address in use error
body: <p>I have an express.js application and it has to run a sub-process everytime there is a particular request (here it is : /compute/real-time ). There will be user-created scripts to compute the data. So, I am using node cluster module to create a pool of workers and pick the one which is free to execute the scripts. But I have hit the wall during the creation of cluster itself. Here is the code
  clusterPool.js </p>
  
  <pre><code>var cluster = require('cluster');
  exports.setupCluster = function(){
  console.log ("Setting up cluster for bot processing " )
    if (cluster.isMaster){
      cluster.fork();   //one is good enough at the moment
    }
  }
  </code></pre>
  
  <p>compute.js </p>
  
  <pre><code>var async = require('async');
  var clusterPool = require('.././clusterPool')
  //Start the cluster
  clusterPool.setupCluster();
  exports.computeRealTime = function(req,res){
      clusterPool.cluster.on("listening",function(worker){
          //....Do something with the worker
      })
  }
  </code></pre>
  
  <p>webserver.js </p>
  
  <pre><code>// Include Express
  var express = require('express');
  var compute = require('.././compute');
  
  // Create a new Express application
  var app = express();
  
  // Add a basic route – index page
  app.get('/compute/real-time',compute.computeRealTime);
  
  // Bind to a port
  app.listen(3000);
  </code></pre>
  
  <p>Here is the error I am facing : </p>
  
  <pre><code>error:  code=EADDRINUSE, errno=EADDRINUSE, syscall=bind
  error: Error: bind EADDRINUSE
  at errnoException (net.js:884:11)
  at net.js:1056:26
  at Object.1:2 (cluster.js:587:5)
  at handleResponse (cluster.js:171:41)
  at respond (cluster.js:192:5)
  at handleMessage (cluster.js:202:5)
  at process.EventEmitter.emit (events.js:117:20)
  at handleMessage (child_process.js:318:10)
  at child_process.js:392:7
  at process.handleConversion.net.Native.got (child_process.js:91:7)
  </code></pre>
  
  <p>IS there any way out for this problem please?
  Thanks in advance</p>