Skip to content
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

race condition in dovecot plugin #1440

Closed
phemmer opened this issue Jul 3, 2016 · 0 comments · Fixed by #1519
Closed

race condition in dovecot plugin #1440

phemmer opened this issue Jul 3, 2016 · 0 comments · Fixed by #1519

Comments

@phemmer
Copy link
Contributor

phemmer commented Jul 3, 2016

Bug report

var outerr error
if len(d.Filters) <= 0 {
d.Filters = append(d.Filters, "")
}
for _, serv := range d.Servers {
for _, filter := range d.Filters {
wg.Add(1)
go func(serv string, filter string) {
defer wg.Done()
outerr = d.gatherServer(serv, acc, d.Type, filter)
}(serv, filter)
}
}

    var outerr error

    if len(d.Filters) <= 0 {
        d.Filters = append(d.Filters, "")
    }

    for _, serv := range d.Servers {
        for _, filter := range d.Filters {
            wg.Add(1)
            go func(serv string, filter string) {
                defer wg.Done()
                outerr = d.gatherServer(serv, acc, d.Type, filter)
            }(serv, filter)
        }
    }

outerr is not protected via a mutex.
Additionally, whichever call to d.gatherServer completes last wins writing to outerr. Meaning if one server fails, stores the error in outerr, but then the second server completes successfully, the first error is lost.

sparrc added a commit that referenced this issue Jul 19, 2016
closes #1439
closes #1440
closes #1441
closes #1442
closes #1443
closes #1444
closes #1445
sparrc added a commit that referenced this issue Jul 19, 2016
closes #1439
closes #1440
closes #1441
closes #1442
closes #1443
closes #1444
closes #1445
sparrc added a commit that referenced this issue Jul 19, 2016
closes #1439
closes #1440
closes #1441
closes #1442
closes #1443
closes #1444
closes #1445
sparrc added a commit that referenced this issue Jul 19, 2016
closes #1439
closes #1440
closes #1441
closes #1442
closes #1443
closes #1444
closes #1445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant