question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'Maximum call stack size exceeded' using async.forEachLimit

See original GitHub issue
async = require('async');

var documents = ['a', 'b', 'c', 'd', 'e', 'f'];

async.forEachLimit(documents, 2, function(item, callback) {
  console.log(".", item);
  callback(null);
}, function(err){
  console.log("end", err);
});

Log

$ node test.js
. a
. a
. a
. a
. a
. a
end undefined
. b
. b
. b
. b
. b
. b
. b
. b
. b
. b
. b
. b
. b
. b
. b
. b
[...]

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
RangeError: Maximum call stack size exceeded

Issue Analytics

  • State:closed
  • Created 12 years ago
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

20reactions
lipsumarcommented, Mar 9, 2017

I was doing a sync operation. I fixed it by changing from:

callback();

to

setTimeout(callback, 0);
17reactions
bobrikcommented, Dec 26, 2011

STOP calling SYNC functions in async.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

async eachLimit and whilst RangeError: Maximum call stack ...
RangeError : Maximum call stack size exceeded. Here is the code: (The SQL query return 100k rows) async.waterfall([ function(cb) ...
Read more >
Fixing "Maximum call stack size exceeded" in async Node.js ...
RangeError : Maximum call stack size exceeded. The line of code in the stack trace pointed to a next() call that would iterate...
Read more >
[Node.js] RangeError: Maximum call stack size exceeded
async.eachSeries users, (user, next) -> process. ... ・'Maximum call stack size exceeded' using async.forEachLimit · Issue #75 · caolan/async ...
Read more >
async - Documentation - GitHub Pages
Async is a utility module which provides straight-forward, powerful functions for working with asynchronous JavaScript. Although originally designed for use ...
Read more >
JavaScript RangeError: Maximum Call Stack Size Exceeded
The above code avoids the error since recursive calls terminate when the base case is met. Track, Analyze and Manage Errors With Rollbar....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found