javascript - Node.js - Diagnose "(node) warning: Recursive process.nextTick detected." -


my application has situation in operation takes long time complete, , couple hundred instances of following message printed:

(node) warning: recursive process.nexttick detected. break in next version of node. please use setimmediate recursive deferral. 

and application crashes with:

rangeerror: maximum call stack size exceeded 

no stack trace.

how diagnose such errors? i'd know, instance, function call preceded rangeerror.

to replicate error, run node foo.js on file foo.js following contents:

var foo = function () {     process.nexttick(foo); }; foo(); 

i not interested in particular cause of problem in application in knowing how diagnose type of problem in node.

node version v0.10.39.

you can replace process.nexttick print sort of useful information – along lines of:

var _nexttick = process.nexttick; var alreadylogged = new set();  process.nexttick = function nexttick(f) {     if (!alreadylogged.has(f)) {         alreadylogged.add(f);          process.nexttick = _nexttick;         console.log(f);         process.nexttick = nexttick;     }      return _nexttick.apply(this, arguments); }; 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -