0

I know that server.timeout and socket's keepalive timeouts has default timeout at 120 sec. But in my case, i have already altered http agent setting to 170 seconds, and also socket.timeout and server timeout to 170 seconds. Still getting error ECONNRESET "socket hangup".

Below is agent setting and socket time settings.

"proxy_agent": {
    "maxSockets" : 256,
    "maxFreeSockets" : 256,
    "keepAlive" : true,
    "keepAliveMsecs" : 170000,
    "keepAliveTimeout" : 15000,
    "timeout" : 170000
},

And Socket settings

var setupSocket = function(socket) {
    socket.setNoDelay(true);
    socket.setTimeout(170000);
    socket.server.timeout = 170000;
    socket.setKeepAlive(true,0);
    return socket;
};

Below is the debugger screenshot showing all my custom values got set properly.

enter image description here

Venkat
  • 81
  • 2
  • 2
  • 10
  • Q: Is your node.js app *MAKING* an http request to a *REMOTE SERVER*? You need to troubleshoot *both* sides of the conversation - local and remote. Look here for some good troubleshooting examples: [Node js ECONNRESET](http://stackoverflow.com/questions/17245881)/node-js-econnreset. ADDITIONAL SUGGESTION: download and familiarize yourself with [Wireshark](https://www.wireshark.org/) and/or [Fiddler2](http://www.telerik.com/fiddler). Both are invaluable troubleshooting tools! – paulsm4 Feb 05 '16 at 21:24
  • Thanks for your response @Paulsm4. Yes, my app is calling a remote server. But when calling the same remote server through curl, it is not timing out at 120 sec so i understood this is with node settings. But not sure where else to change the timeout settings considering all places already changed. – Venkat Feb 15 '16 at 15:29

1 Answers1

0

Finally i got the problem. There are two separate events for http('connection') and https('secureConnection') and so socket timeout is disabled only for http previously. So all https requests still getting timedout at default 120 seconds. So After disabling sockets for 'secureConnection' event, then https requests are actually working till the given request timeout.

Note: This problem exists only for https and i initially failed to recognize which is crucial in solving. Thanks.

Venkat
  • 81
  • 2
  • 2
  • 10