476050
node新手,编译安装 ./configure --prefix=/path, 版本:v0.10.26
代码如下:
var http = require('http');
//http.globalAgent.maxSockets = 100;
for (var i = 0; i <= 500; i++)
{
http.get("http://www.baidu.com", function(res){
console.log('ok--\n');
}).on('error', function(e){
console.log(e);
});
}
执行效果:默认maxSockets是5,执行5个get后就会卡住。
strace 效果如下:
strace -p 25817 Process 25817 attached - interrupt to quit clock_gettime(CLOCK_MONOTONIC, {20601802, 628068955}) = 0 epoll_wait(5,
然后就阻塞在这里。 如果把maxSockets调大,执行指定数值后也会卡住。
请问是什么原因,是安装的不正确?