I'm having trouble with my Node.js CPU becoming pegged. I noticed that it correlates exactly to when I have a ETIMEDOUT error when making a HTTP request from the node.js server.
I found this issue which might the issue exactly. To quote:
that the issue is not a problem of node.js native code, but it is of how mongodb driver manages it;s connection pool. It pushes one connection waiting method to the queue infinitely, until some response from system got. And when connections just hungs, this waiting method start to reiterate it self forever.
However, the issue was supposedly fixed in the Mongo drivers about a year ago.
Here's the error, as it appears in my log:
Sat Nov 17 2012 08:48:11 GMT-0800 (PST): Error: ETIMEDOUT
Sat Nov 17 2012 08:48:11 GMT-0800 (PST): "Error: ETIMEDOUT\n at Object.<anonymous> (/home/webapps/SGPArray/releases/20121117084123/api/node_modules/request/main.js:670:15)\n at Timer.list.ontimeout (timers.js:101:19)"
While the socket is timing out, the node.js CPU is 100% pegged. After the error is dispatched, CPU usage returns to normal.
Ideas?
The code is pretty straightforward, doesn't even seem worthwhile to post
request({'uri': url}, function(err, resp) {
if(err)
{
callback(err);
return;
}
parseArticles(resp);
});