Skip to content

Conversation

rhcarvalho
Copy link
Contributor

@rhcarvalho rhcarvalho commented Sep 1, 2016

Calling wg.Done() does not "cancel" the WaitGroup, it does introduce a
bug in which depending on timing the WaitGroup counter might go
negative, what should never happen.

Would be nice to rewrite the method to be correct concurrent code, but
for now should be enough to avoid the panic condition and note that
there is a potential leak.


Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1370265

@rhcarvalho
Copy link
Contributor Author

rhcarvalho commented Sep 1, 2016

I propose this instead of #577, @gabemontero @bparees PTAL.
Sorry for coming with a PR, was easier to explain with code than lots of comments (without the code).

}

wg := sync.WaitGroup{}
var wg sync.WaitGroup
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to initialize WaitGroups, just declare them and they are ready for use.
Idiomatic example: https://golang.org/pkg/sync/#example_WaitGroup

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't let the PM team see this :-) ... they prefer the :=

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i also prefer := :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a necessary change, so will revert it to minimize the patch ;)

@gabemontero
Copy link
Contributor

LGTM ... I'll delete the other pull when this merges.

@bparees - shall we assign the associated bugzilla and UPSTREAM vendor update to @rhcarvalho :-) ?

@rhcarvalho
Copy link
Contributor Author

@bparees - shall we assign the associated bugzilla and UPSTREAM vendor update to @rhcarvalho :-) ?

Would be fun, but I don't want to overcommit :)

I'll be happy to send more s2i PRs when I come back (soon) 😄 , missing you guys

Calling wg.Done() does not "cancel" the WaitGroup, it does introduce a
bug in which depending on timing the WaitGroup counter might go
negative, what should never happen.

Would be nice to rewrite the method to be correct concurrent code, but
for now should be enough to avoid the panic condition and note that
there is a potential leak.

---

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1370265
@bparees
Copy link
Contributor

bparees commented Sep 1, 2016

lgtm [merge]
@gabemontero please do the upstream PR to origin, we've already abused @rhcarvalho enough :)

@openshift-bot
Copy link
Contributor

Evaluated for source to image merge up to b5d4d3e

@openshift-bot
Copy link
Contributor

openshift-bot commented Sep 1, 2016

Source To Image Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_sti/207/)

@gabemontero
Copy link
Contributor

roger that @bparees

@gabemontero
Copy link
Contributor

and thx @rhcarvalho :-)

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 this pull request may close these issues.

4 participants