Skip to content

Instantly share code, notes, and snippets.

@PaulMougel
Created November 22, 2013 13:02
Show Gist options
  • Save PaulMougel/7599512 to your computer and use it in GitHub Desktop.
Save PaulMougel/7599512 to your computer and use it in GitHub Desktop.
Example of a failing async.queue usage, resulting in a stack overflow
$ node -v
v0.10.16
$ node index.js
/root/tmp/node_modules/async/lib/async.js:710
process: function () {
^
RangeError: Maximum call stack size exceeded
var async = require('async'); // async 0.2.9
var process = function (doc, cb) {
cb(doc);
};
var queue = async.queue(process, 1);
var i;
// Synchronously create a lot of tasks
for (i = 0 ; i < 10000 ; i++) {
queue.push(i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment