{"action":"created","issue":{"url":"https://api.github.com/repos/caolan/async/issues/1266","repository_url":"https://api.github.com/repos/caolan/async","labels_url":"https://api.github.com/repos/caolan/async/issues/1266/labels{/name}","comments_url":"https://api.github.com/repos/caolan/async/issues/1266/comments","events_url":"https://api.github.com/repos/caolan/async/issues/1266/events","html_url":"https://github.com/caolan/async/issues/1266","id":170526235,"number":1266,"title":"Segmentation Fault: 11, large async.queue size","user":{"login":"rtran9","id":11001605,"avatar_url":"https://avatars.githubusercontent.com/u/11001605?v=3","gravatar_id":"","url":"https://api.github.com/users/rtran9","html_url":"https://github.com/rtran9","followers_url":"https://api.github.com/users/rtran9/followers","following_url":"https://api.github.com/users/rtran9/following{/other_user}","gists_url":"https://api.github.com/users/rtran9/gists{/gist_id}","starred_url":"https://api.github.com/users/rtran9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtran9/subscriptions","organizations_url":"https://api.github.com/users/rtran9/orgs","repos_url":"https://api.github.com/users/rtran9/repos","events_url":"https://api.github.com/users/rtran9/events{/privacy}","received_events_url":"https://api.github.com/users/rtran9/received_events","type":"User","site_admin":false},"labels":[{"id":213519564,"url":"https://api.github.com/repos/caolan/async/labels/question","name":"question","color":"d4c5f9","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-08-10T21:44:17Z","updated_at":"2016-12-14T15:11:04Z","closed_at":"2016-08-11T01:53:18Z","body":"**What version of async are you using?**\n`v4.4.7`\n\n**Which environment did the issue occur in (Node version/browser version)**\n`async@2.0.1`\n\n**What did you do? Please include a minimal reproducible case illustrating issue.**\n\n```\nvar async = require(\"async\");\n\nvar count = 0;\nvar queue = async.queue(function(item, callback) {\n    count += 1;\n    console.log(count);\n    callback(null);\n});\n\nqueue.drain = function () {\n    console.log(\"done\");\n};\n\nvar data = new Array(20000);\nqueue.push(data);\n```\n\n**What was the actual result?**\n\nNode throws this error `Segmentation fault: 11` after popping some of the items from the queue.\n\n```\n...\n13440\n13441\n13442\n13443\n13444\n13445\n13446\n13447\n13448\n13449\n13450\n13451\nSegmentation fault: 11\n```\n\nTo 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`.\n\nCan anyone explain to me whats going on? It works up until a certain array size.\n"},"comment":{"url":"https://api.github.com/repos/caolan/async/issues/comments/267058659","html_url":"https://github.com/caolan/async/issues/1266#issuecomment-267058659","issue_url":"https://api.github.com/repos/caolan/async/issues/1266","id":267058659,"user":{"login":"alexellis","id":6358735,"avatar_url":"https://avatars.githubusercontent.com/u/6358735?v=3","gravatar_id":"","url":"https://api.github.com/users/alexellis","html_url":"https://github.com/alexellis","followers_url":"https://api.github.com/users/alexellis/followers","following_url":"https://api.github.com/users/alexellis/following{/other_user}","gists_url":"https://api.github.com/users/alexellis/gists{/gist_id}","starred_url":"https://api.github.com/users/alexellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexellis/subscriptions","organizations_url":"https://api.github.com/users/alexellis/orgs","repos_url":"https://api.github.com/users/alexellis/repos","events_url":"https://api.github.com/users/alexellis/events{/privacy}","received_events_url":"https://api.github.com/users/alexellis/received_events","type":"User","site_admin":false},"created_at":"2016-12-14T15:11:04Z","updated_at":"2016-12-14T15:11:04Z","body":"@caolan @hargasinski  I cannot manage to make this work, I still get a `Segmentation fault: 11` with 36k files:\r\n\r\nCan you suggest a pattern or alternative to get past this?\r\n\r\n```\r\n$ node --stack-size=42000 app.js ../flat/\r\n```\r\n\r\n```\r\n'use strict'\r\n\r\nlet fs = require('fs')\r\nlet async = require('async')\r\nlet request = require('request')\r\n\r\nvar q = async.queue((task, cb) => {\r\n    console.log(task);\r\n    async.setImmediate(cb(), null);\r\n}, 5);\r\n\r\nq.pause();\r\nfs.readdir(process.argv[2], (err, res) => {\r\n\r\n    for (var i = 0; i < res.length; i++) {\r\n        q.push(res[i]);\r\n    }\r\n    q.resume();\r\n})\r\n```"}}
{"actor":{"display_login":"alexellis"}}