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 https://redacted.com 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, Socket.io 1.3.6. at AWS t2.micro for testing.
Server:
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/redacted.ca-bundle')
};
var app = https.createServer(options);
var client = require('socket.io').listen(app); //socket.io server listens to https connections
app.listen(8080);
var connected = 1;
client.on('connection', function(socket){
function sendStatus(s){
socket.emit('status', s);
}
sendStatus('Connected');
console.log(connected);
connected++;
});
Client:
try{
var socket = new io.connect('ws.redacted.com:8080');
//var socket = io.connect('ws.redacted.com:8080');
console.log(socket);
}catch(e){
//set status to warn user
console.log('3');
console.log(e);
}