[nodejs] http.createClient and HTTP requst in loop, only 255 request, next - Error: EMFILE, Too many open files

37 views
Skip to first unread message

aleks raiden

unread,
May 7, 2010, 10:50:48 AM5/7/10
to nodejs
Hi all,

Currently, used v0.1.94-3-gc07c601, i trying to create periodical HTTP
GET query. And only 255 query if fine, next is wrong - Error: EMFILE,
Too many open files. What? I trying manually destroy socket and delete
request object, but nothing...

--
You received this message because you are subscribed to the Google Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.

Micheil Smith

unread,
May 7, 2010, 11:11:45 AM5/7/10
to nod...@googlegroups.com
Please do attach your code.

-- Micheil Smith

Александр Лозовюк

unread,
May 8, 2010, 6:00:14 AM5/8/10
to nod...@googlegroups.com
Hi Micheil, 

My code is simple: 

at setInterval I emmitted 'url_request' event (every 5 seconds), and in the listener:

emitter.addListener('url_request', function(){
     var idc_client = http.createClient(options.idc_port, options.idc_ip);
     var idc_req = idc_client.request('GET', options.idc_command + param, {
'User-Agent':'Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3',
'Accept': 'text/html,text/xml,application/xhtml+xml,application/xml,text/csv',
'Host': options.idc_host,
'Keep-Alive' : options.idc_keepalive,
'Connection' : 'keep-alive',
'Accept-Language' : 'en,en-us',
'Accept-Charset' : 'utf-8'
});

       idc_req.addListener('response', function (response){
options.allQuery++; //query counter

                var data = '';

               response.addListener('data', function (chunk){ data = data + chunk;  });

               response.addListener('end', function(){ 
                    // processing responce data

                sys.puts('Request end');
   idc_req.socket.destroy();
idc_req.removeAllListeners('data');
idc_req.removeAllListeners('end');
idc_req.removeAllListeners('response');
idc_req.destroy();
idc_client.destroy();
               });

      });

idc_req.end();
}); 

Where is my error?








2010/5/7 Micheil Smith <mic...@brandedcode.com>



--
C уважением, Александр Лозовюк
Alpha-Beta-Release Blog
http://abrdev.com

Александр Лозовюк

unread,
May 8, 2010, 9:43:58 AM5/8/10
to nod...@googlegroups.com
at the today latest master - all works fine. 

8 мая 2010 г. 13:00 пользователь Александр Лозовюк <aleks....@gmail.com> написал:
Reply all
Reply to author
Forward
0 new messages