title: Node.js Error : Error [ERR_IPC_CHANNEL_CLOSED]
body: <p>I have a simple Node.js application using sticky-session, express and socket.io.
  I have checked the Sticky-session library files and it should spawn a new worker once one of the other one dies, and so I tested to exit a process on 1 of the workers. But now instead of creating just a new worker, my whole application crashes and gives me this error : </p>
  
  <pre><code>emitting message: adad . socket.id=YcaiZWUFKlF12lD9AAAB . pid = 11448
  emitting message: adadadad . socket.id=YcaiZWUFKlF12lD9AAAB . pid = 11448
  
  events.js:182
        throw er; // Unhandled 'error' event
        ^
  
  Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
      at ChildProcess.target.send (internal/child_process.js:590:16)
      at Worker.send (internal/cluster/worker.js:54:28)
      at Server.&lt;anonymous&gt; (C:\Users\name\Desktop\socket.io + node cluster + redis WORKING\node_modules\sticky-session\lib\sticky-session.js:54:14)
      at emitOne (events.js:115:13)
      at Server.emit (events.js:210:7)
      at TCP.onconnection (net.js:1554:8)
  </code></pre>
  
  <p>Here my Server Code</p>
  
  <pre><code>var express = require('express');
  var http = require('http');
  var sticky = require('sticky-session');
  
  var expressHandler = require("./handlers/expressHandler")
  var redisHandler = require("./handlers/redisHandler")
  var ioSocketHandler = require("./handlers/socketHandler")
  
  var config = require("./configuration/default")
  var port = config.web.port;
  var workers = config.system.cores
  
  var app = express();
  
  
  ///////////////////////////////////
  //      HTTP SERVER
  ///////////////////////////////////
  
  sticky(workers, function() {
  
    var server = http.createServer(app);
  
    var io = require('socket.io')(server);
  
    redisHandler(io)
  
    ioSocketHandler(io)
  
    return server;
  
  }).listen(port, function() {
  
    console.log(`server started on port ${port}. process id = ${process.pid}`);
  
  });
  
  
  ///////////////////////////////////
  //      EXPRESS
  ///////////////////////////////////
  
  expressHandler(app)
  </code></pre>
  
  <p>And here the express module which causes the error on purpose</p>
  
  <pre><code>var config = require("../configuration/default")
  var cookieParser = require('cookie-parser');
  var session = require("express-session")({
      secret: config.cookie.secret,
      resave: true,
      saveUninitialized: true
  })
  
  function initialiseExpressHandlers(app) {
  
      app.use(cookieParser());
  
      session.Cookie
  
      app.use(session);
  
      app.get('/', function(req, res) {
          console.log(req.session)
          res.sendfile('index.html');
      });
  
      app.get('/kill', function(req, res) {
          process.exit(1);
      });
  
  }
  
  module.exports = initialiseExpressHandlers
  </code></pre>
  
  <p>And finally the Redis Adaptar I use to handle socket.io in a cluster. The other code should be irrelevant.</p>
  
  <pre><code>var redis = require('redis');
  var redisAdapter = require('socket.io-redis');
  
  function initialiseRedisHandler(io) {
  
      var redisUrl = process.env.REDISTOGO_URL || 'redis://127.0.0.1:6379';
      var redisOptions = require('parse-redis-url')(redis).parse(redisUrl);
      var pub = redis.createClient(redisOptions.port, redisOptions.host, {
          detect_buffers: true,
          auth_pass: redisOptions.password
      });
      var sub = redis.createClient(redisOptions.port, redisOptions.host, {
          detect_buffers: true,
          auth_pass: redisOptions.password
      });
  
      io.adapter(redisAdapter({
          pubClient: pub,
          subClient: sub
      }));
      console.log('Redis adapter started with url: ' + redisUrl);
  
  }
  
  module.exports = initialiseRedisHandler
  </code></pre>