i have a small app (in Node.JS) that connects a bunch of longpolling connections to a server via https.request
var data = "{'foo':'bar'}";
var options = {
'host' : '127.0.0.1',
'port' : '443',
'path' : '/push',
'method' : 'POST',
'rejectUnauthorized' : false,
'agent' : false,
'headers' : {
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
var request = require('https').request(options, function(responseStream){
responseStream.setEncoding('utf8');
var responseData = "";
responseStream.on('data', function (chunk) {
responseData += chunk;
});
responseStream.on('end', function() {
// trigger callback on master
process.send({
"type" : Constants.PROCESSORS.MESSAGE.REPLY,
"data" : responseData
});
});
});
request.write(data);
request.end();
the request inits, receives a socket, and after around ~20 seconds i receive a socket hang up error. it never reaches the 'connected' state ('connect' event not thrown).
error callstack:
"Error: socket hang up
at createHangUpError (_http_client.js:192:15)
at TLSSocket.socketOnEnd (_http_client.js:270:23)
at emitNone (events.js:70:20)
at TLSSocket.emit (events.js:147:7)
at _stream_readable.js:891:16
at process._tickCallback (node.js:337:11)"
EDIT: i forgot to mention that the remote server is a balancer that uses HAProxy, but i managed to reproduce this with a simple server (no balancer, just node.js web server)