Created
November 22, 2013 13:02
-
-
Save PaulMougel/7599512 to your computer and use it in GitHub Desktop.
Example of a failing async.queue usage, resulting in a stack overflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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