On Thu, Feb 28, 2013 at 11:00 AM, Michael <[email protected]> wrote: > Hi, > > i make a lot of http calls to my backend. I use a custom > var myagent = new http.Agent(); > myagent.maxSockets = 50; > for my requests. If i make 51 requests at a time, the last request will see > an error: > Error: socket hang up > at createHangUpError (http.js:1373:15) > at Socket.socketOnEnd [as onend] (http.js:1470:23) > at TCP.onread (net.js:419:26)' > I do my requests like this: > var req = http.request({ > host: "localhost", > port: 9999, > path: "/api/test", > method: "POST", > headers: { > "accept": "application/json", > "accept-charset": "utf-8", > "connection": "keep-alive" > }, > agent: myagent > }); > req.on("response", function (response) { ... }); > req.on("error", function(e) { ... }); > req.end("{}", "utf8"); > > > As far as I understand the agent, the request should just wait in the queue > until one of the requests is finished to get picked up. > > ECONNRESET seems to mean something like sending data after the socket is > closed. > > > If i set agent: false or if I don't reach the maximum amount of requests > everything is fine.
"socket hang up" means the other end has unexpectedly closed the connection. Presumably the server closes the connection even though it advertises keep-alive, i.e. HTTP/1.0 with a Connection: keep-alive header or HTTP/1.1 without a Connection: close header. It could also be something more subtle like the server sending a bad Content-Length header. -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
