You should wrap your recursive function call into a. setTimeout ,; setImmediate or ; process.nextTick. function ...
stackoverflow.com