1

Recently, I sank into the issue on "ETIMEDOUT Connection timed out". My application just use the get() method to download files and data from the remote server. during the downloading(I mean I have downloaded some files but not completely), I just get the "ETIMEDOUT Connection timed out". It's a bug of node.js? I use node.js 0.4.10. Because of the ETIMEDOUT, I cannot download files completely.

http = require('http');
client_req = http.get(...)//

//...
client_req.on('error', callback(err){...})/*When ETIMEDOUT, I get the error 
message: ETIMEDOUT  Connection timed out  here.*/
hyman
  • 43
  • 1
  • 5
  • 1
    The error is what it's named, a timeout. Not necessarily a node.js bug. Do you get timeouts when you use curl with the same url? – fent Dec 15 '11 at 06:21
  • 1
    Hi, I am not sure about curl. But as I descriped above. For example, I have 10 files to download from the same connection. I always have already downloaded 5 or 9 files, then , ETIMEDOUT Connection timed out. I don't know why. These days I try to read the source code of node.js to solve this problem. But I am failed. And I could not find a correct to print the log in the lib/http.js lib/net.js to locat who emit the ETIMEDOUT error. – hyman Dec 15 '11 at 06:50

1 Answers1

1

This is not a Node.js bug, most probably the url cannot be reached anymore, that's why you get a timeout. As @DeaDEnD suggested, do a curl to see if you get a timeout also with cURL.

alessioalex
  • 62,577
  • 16
  • 155
  • 122
  • Hi, I am not sure about it. how about the node.js http client request quene? I find that there is maxsockets = 5 in the http.js. Because that my application must get() hundreds of times at one time. – hyman Dec 15 '11 at 06:57
  • You can set agent: false to override that: http://nodejs.org/docs/latest/api/http.html#http.get – alessioalex Dec 15 '11 at 07:19
  • set the agent: false. But the "ETIMEDOUT Connection timed out" sometime comes again. – hyman Dec 15 '11 at 08:16
  • Did you curl the url a few times? Are you sure that site doesn't often timeout? – alessioalex Dec 15 '11 at 08:19
  • um, I will test the url use curl right now. Because of the urls are not always the same. So it will take a long time. – hyman Dec 15 '11 at 08:25
  • 1
    I just write a shell script curl 10,000 times to the server url. nothing happend. I don't get any timed out error. oops... – hyman Dec 15 '11 at 08:49