Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async.series max call stack size exceed #173

Closed
leanderlee opened this issue Aug 25, 2012 · 3 comments
Closed

async.series max call stack size exceed #173

leanderlee opened this issue Aug 25, 2012 · 3 comments

Comments

@leanderlee
Copy link

This simple tests produces an error on node v0.8.0 on Windows 7 x64.

https://gist.github.com/3457903

What is the proper way to do this?

@fent
Copy link

fent commented Aug 25, 2012

Usually the array of async functions is supposed to be that, async functions. If some condition in your function makes it so it can call the callback synchronously, use process.nextTick()

@chesles
Copy link

chesles commented Aug 25, 2012

generateTask should use process.nextTick to return asyncronous tasks:

var generateTask = function (num) {
  return function (callback) {
    process.nextTick(function() {
      callback(null, 'The number is at ' + num);
    });
  }
}

@leanderlee
Copy link
Author

Ah, that did it. Thanks for your help!

joliss added a commit to broccolijs/broccoli that referenced this issue Nov 14, 2013
Sometimes the preprocessors and compilers call their callback
synchronously. In those cases, async.eachSeries will recurse
synchronously, and the call stack will grow very large.

Also see caolan/async#75 (comment)
and caolan/async#173 (comment).

Incidentally, this cuts initial build time in half.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants