node.js - Error: connect EADDRNOTAVAIL while processing big async loop -


i experiencing strange problem. importing big xml-files , store them mongodb. algorythm typical async loop:

doloop = function( it, callback_loop ) {     if( < no_of_items ) {         storetomongo( ..., function( err, result ) {                 ...                 doloop( it+1, callback_loop );         });     } else {         callback_loop();     } }; doloop( 0, function() {     ... }); 

now (suddenly without remarkable change in code) following error while performing loop:

events.js:72         throw er; // unhandled 'error' event               ^ error: connect eaddrnotavail     @ errnoexception (net.js:901:11)     @ connect (net.js:764:19)     @ net.js:842:9     @ dns.js:72:18     @ process._tickcallback (node.js:415:13) 

the error happens after approximately minute. number of items processed in meantime quite same, not exactly.

i tried find out connect/net causes error, lost. there not socket-connection in code. have connection redis, o.k. mongodb-connection? why lost suddenly?

the thing helps run through whole loop perform recursive loop call within mongo-callback this:

settimeout( function() {     doloop( it+1, callback_loop ); },1); 

anyone out there has idea going wrong here?

thanks, heinob

finally have found answer. problem within default global http agent. see full description here.


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -