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
eachSeries with a nested async call results in maximum call stack size exceeded #1265
Labels
Comments
+1 |
1 similar comment
+1 |
The reason this worked in async 1.5.2 is we ensured the callback was always called asynchronously in that version. In version 2 we removed this guard (see https://github.com/caolan/async/blob/master/intro.md#synchronous-iteration-functions) So in your case to fix the script you can either use var counter = 2000;
async.eachSeries(
new Array(counter),
(item, cb) => {
async.parallel([
(pCb) => {
console.log(counter--);
async.setImmediate(pCb);
},
], cb);
},
() => console.log('done')
); |
Stono
added a commit
to hawkeyesec/scanner-cli
that referenced
this issue
Oct 24, 2017
This was a nested async callstack issue, see: - See: caolan/async#1265
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of async are you using?
2.0.1
Which environment did the issue occur in (Node version/browser version)
Node 6.2.1
NPM 3.9.3
What did you do? Please include a minimal reproducable case illustrating issue.
What did you expect to happen?
I expected each of the iterations to occur, which would result in the last two console.log's being '1' and 'done'.
What was the actual result?
After fewer than 1000 iterations, I would receive this error:
RangeError: Maximum call stack size exceeded
When I reverted back to async 1.5.2, the above code worked as expected.
The text was updated successfully, but these errors were encountered: