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

RangeError when using queue with 5000+ tasks. #510

Closed
LiamKarlMitchell opened this issue Apr 15, 2014 · 5 comments
Closed

RangeError when using queue with 5000+ tasks. #510

LiamKarlMitchell opened this issue Apr 15, 2014 · 5 comments

Comments

@LiamKarlMitchell
Copy link

I have made a pull request with a test that fails.
#509

RangeError Maximum call stack size exceeded

It is basicaly this

var q = async.queue(function(task,cb) { cb(); })
q.pause();

for (var i=0; i< 5000; i++) {
  q.push({ index: i });
}

q.resume();

When cb is called there can be RangeError's
I don't know enough to figure out why though.

@LiamKarlMitchell
Copy link
Author

eachLimit and eachSeries also has this problem.

@caolan
Copy link
Owner

caolan commented Apr 15, 2014

You need to call cb() asynchronously. Try setImmediate(cb) instead.

@caolan caolan closed this as completed Apr 15, 2014
@LiamKarlMitchell
Copy link
Author

Ah my mistake thankyou @caolan
Just wondering couldn't the call back be internally handled to call async to avoid a mistake like this?
Or is there a good reason that it is required?

Cheers,

LiamKarlMitchell added a commit to LiamKarlMitchell/InfiniteSky that referenced this issue Apr 15, 2014
Needed to call callback async.. duh.

caolan/async#510 (comment)
@caolan
Copy link
Owner

caolan commented Apr 16, 2014

Making your sync functions magically async would just mask the problem, so I prefer not to add it into the library.

@bishopZ
Copy link

bishopZ commented Apr 23, 2014

Btw, Frame.js v2 resolved this issue. https://github.com/bishopZ/Frame.js

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