Focus on IT Recommend

Home > node.js - Socket io + Node Error: getaddrinfo EADDRINFO after a few hours with < 100 connections

node.js - Socket io + Node Error: getaddrinfo EADDRINFO after a few hours with < 100 connections

I have a node + socket server running to simply emit to the clients. The client is on an https domain name. After a couple or few hours my socket server starts to log { [Error: getaddrinfo EADDRINFO] code: 'EADDRINFO', errno: 'EADDRINFO', syscall: 'getaddrinfo', fatal: true } killing all of the websocket connections and not being corrected until I restart the script that is running the server. After I restard the server script everything is fine for 2-3 hours.

The load is low, only me opening 10 - 30 tabs in my web browser.

I have searched all over including these and other questions 25684451,12565209, and 29536649.

As I mentioned my domain is and as a result need, I believe, the socket server needs to be https as well, which is how I built it.

Is it hardware? Ubuntu's open file limit? https issue? dns routing issue? socket connection limit? How do I even test?

Ubuntu 14.04, nodeJS v0.10.25, 1.3.6. at AWS t2.micro for testing.


var https = require('https'),
  fs = require('fs'),
  mysql = require('mysql');

var options = {
  key: fs.readFileSync('/etc/ssl/certs/key2/redacted.key'),
  cert: fs.readFileSync('/etc/ssl/certs/key2/STAR_redacted_com.crt'),
  ca: fs.readFileSync('/etc/ssl/certs/key2/')

var app = https.createServer(options);
var client = require('').listen(app);     // server listens to https connections

var connected = 1;
client.on('connection', function(socket){
  function sendStatus(s){
    socket.emit('status', s);


  var socket = new io.connect('');
  //var socket = io.connect('');
  //set status to warn user

Recommend:node.js - Authenticating socket io connections

another server (python) to get a token, how can I get use that token whenever a user opens a socket connection on the node side io.on('connection', function(socket) { socket.on('message', function(message) { io.emit('message',


------splitte line----------------------------