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
Segmentation Fault: 11, large async.queue size #1266
Comments
See #1265 for a little more info. Essentially, Using var async = require("async");
var count = 0;
var queue = async.queue(function(item, callback) {
count += 1;
console.log(count);
async.setImmediate(callback, null);
});
// rest of your code... or using var async = require("async");
var count = 0;
var queue = async.queue(async.ensureAsync(function(item, callback) {
count += 1;
console.log(count);
callback(null);
}));
// rest of your code... In terms of a little more detailed explanation of what's happening to answer your question. The When |
@hargasinski thank you! this explains it |
@caolan @hargasinski I cannot manage to make this work, I still get a Can you suggest a pattern or alternative to get past this?
'use strict'
let fs = require('fs')
let async = require('async')
let request = require('request')
var q = async.queue((task, cb) => {
console.log(task);
async.setImmediate(cb(), null);
}, 5);
q.pause();
fs.readdir(process.argv[2], (err, res) => {
for (var i = 0; i < res.length; i++) {
q.push(res[i]);
}
q.resume();
}) |
@alexellis I think it might be because you're invoking Also, quick side note, |
How embarrassing that I couldn't see those This is something I put together to help people learn the |
Awesome, thanks for putting that together, I'll check it out. |
What version of async are you using?
v4.4.7
Which environment did the issue occur in (Node version/browser version)
async@2.0.1
What did you do? Please include a minimal reproducible case illustrating issue.
What was the actual result?
Node throws this error
Segmentation fault: 11
after popping some of the items from the queue.To get this to run in the first place without a
Maximum call stack size exceeded
error, I increased the stack size:node --stack-size=32000
.Can anyone explain to me whats going on? It works up until a certain array size.
The text was updated successfully, but these errors were encountered: