"RangeError: Maximum call stack size exceeded" and "warning: Recursive process.nextTick detected"
See original GitHub issueFor the first time I test Nedb, I encounter that problem. My code is very simple:
var Datastore = require('nedb')
, db = new Datastore({ filename: '.\\my.db', autoload: true });
function test() {
db.update({ '0': 10 }, { $inc: { distance: 38 } }, { upsert: true }, function (err) {
if(err) {
console.log('Oops!');
} else {
db.count({ '0': 10 }, function (err, count) {
console.log('Count: ' + count);
});
console.log('Yeah!');
}
});
}
for(var i=0; i < 1000; i++) {
test();
}
I don’t think it’s my fault but I can’t find root cause of this problem (I am newbie so…). Much appreciate for your help. BTW, I ran it on Windows 8 64bit using node v0.10.28 x64 official binary.
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
(node) warning: Recursive process.nextTick detected - RangeError ...
I had the same problem and this solution worked for me in Ubuntu 12.04: grunt throw “Recursive process.nextTick detected”.
Read more >JavaScript RangeError: Maximum Call Stack Size Exceeded
The RangeError: Maximum call stack size exceeded is thrown when a function call is made that exceeds the call stack size. This can...
Read more >Uncaught RangeError: Maximum call stack size exceeded
This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript...
Read more >InternalError: too much recursion - JavaScript - MDN Web Docs
The JavaScript exception "too much recursion" or "Maximum call stack size exceeded" occurs when there are too many function calls, or a function...
Read more >RangeError: Maximum call stack size exceeded - Educative.io
The most common source for this error is infinite recursion. You must have a recursive function in your code whose base case is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This was indeed an issue caused by
process.nextTick
. NowsetImmediate
is used and the bug was fixed, as of v0.10.11Like I said in the previous comment (https://github.com/louischatriot/nedb/issues/177#issuecomment-46116633) setImmediate will start a new call stack. Used at the right place, it can split your 1000x call stacks to 1000 stacks with the length of x 😃