Socket: Not running issue when disconnecting cluster
Opened this issue · 0 comments
AlexMeah commented
First off great module, unfortunately we are seeing a high number of the error below when cycling boxes during deployment.
Error: Not running
at Socket._healthCheck (dgram.js:420:11)
at Socket.send (dgram.js:272:8)
at Lynx.send (/usr/local/moonstick/node_modules/lynx/lib/lynx.js:470:10)
at Lynx.count (/usr/local/moonstick/node_modules/lynx/lib/lynx.js:310:8)
at Lynx.increment (/usr/local/moonstick/node_modules/lynx/lib/lynx.js:228:8)
at module.exports (/usr/local/moonstick/lib/middleware/requestStats.js:8:13)
I have put together a simple example to reproduce the error
var Lynx = require('./lib/lynx');
var cluster = require('cluster');
var metrics = new Lynx('localhost', 2056);
if (cluster.isMaster) {
for (var i = 0; i < 1; i++) {
cluster.fork();
}
cluster.on('exit', function (worker, code, signal) {
console.log('worker ' + worker.process.pid + ' died');
});
cluster.on('online', function (worker, code, signal) {
console.log('worker ' + worker.process.pid + ' online');
cluster.disconnect();
});
} else {
metrics.increment('node_test.int', 1);
}
We could add a custom error handler and filter these but I believe it is a issue with Lynx as googling the stack shows similar issues in other module which use dgram.