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

fix: Mutating variables within go closures should be explicit. #788

Merged
merged 1 commit into from
Aug 16, 2017

Conversation

harshavardhana
Copy link
Member

@harshavardhana harshavardhana commented Aug 15, 2017

partSize, a variable on the stack, changes over the course of
uploading multiple objects. This was being used in a function
closure as a go-routine. The variables used in the closure
depend on their values the time of evaluation providing inconsistent
behavior. It is racy to depend on values of variables on stack
at the end of function, when go-routines are executed.

Fixes #784

partSize, a variable on the stack, changes over the course of
uploading multiple objects. This was being used in a function
closure as a go-routine. The variables used in the closure
depend on their values the time of evaluation providing inconsistent
behavior. It is racy to depend on values of variables on stack
at the end of function, when go-routines are executed.

Fixes minio#784
Copy link
Contributor

@fwessels fwessels left a comment

Choose a reason for hiding this comment

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

Nasty bug, LGTM

Copy link
Member

@vadmeste vadmeste left a comment

Choose a reason for hiding this comment

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

LGTM

@deekoder deekoder merged commit 2e47638 into minio:master Aug 16, 2017
@harshavardhana harshavardhana deleted the fix-racy-go-routine branch August 16, 2017 22:51
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