Skip to content

async.each callback could be called more than once when array is modified #557

@mingqi

Description

@mingqi
var async = require('async')

inputs = [1,2]
async.each(inputs,
    function (item, callback) {
        setTimeout(function(){callback()}, 1000)
    },
    function(err){
        console.log("async.each done")  
    })

inputs.splice(1,1)

/* output is:
async.each done
async.each done
*/

the problem is async use completed >= arr.length to check if call callback. however arr.length is less than async.each was called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions