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 race conditions #6118

Merged
merged 6 commits into from May 30, 2014
Merged

Fix race conditions #6118

merged 6 commits into from May 30, 2014

Conversation

@LK4D4
Copy link
Contributor

@LK4D4 LK4D4 commented May 30, 2014

I've built docker with race flag and found some race condition. After fixes, with 15 minutes load of ./docker-stress -c 20 -t 1 I didn't saw any races.

LK4D4 added 4 commits May 29, 2014
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
@LK4D4
Copy link
Contributor Author

@LK4D4 LK4D4 commented May 30, 2014

LK4D4 added 2 commits May 30, 2014
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
}
}

func (l *List) Back() *list.Element {

This comment has been minimized.

@pnasrat

pnasrat May 30, 2014
Contributor

Please add comments for godoc for each of the exported functions.

func (l *List) Back() *list.Element {
l.mu.Lock()
res := l.List.Back()
l.mu.Unlock()

This comment has been minimized.

@pnasrat

pnasrat May 30, 2014
Contributor

defer Unlock might be preferred style

return res
}

// Prev needed just for synchronization of elements

This comment has been minimized.

@pnasrat

pnasrat May 30, 2014
Contributor

If these are just needed internally don't export. Else the godoc should be user facing.

"sync"
)

// Package safelist containing goroutine-safe linked list

This comment has been minimized.

@pnasrat

pnasrat May 30, 2014
Contributor

Probably should have some tests for this package.

@LK4D4
Copy link
Contributor Author

@LK4D4 LK4D4 commented May 30, 2014

@pnasrat sorry, I've rewrited it already without using ugly safelist :) I'll push it soon.
But defer brings big overhead comparing to light functions. I wrote about it here

@crosbymichael
Copy link
Contributor

@crosbymichael crosbymichael commented May 30, 2014

@LK4D4 is this ready for review? I didn't understand your last comment.

@LK4D4
Copy link
Contributor Author

@LK4D4 LK4D4 commented May 30, 2014

@crosbymichael Yeah, it is ready :) Just forgot to mention that I pushed my changes

@unclejack
Copy link
Contributor

@unclejack unclejack commented May 30, 2014

LGTM

1 similar comment
@crosbymichael
Copy link
Contributor

@crosbymichael crosbymichael commented May 30, 2014

LGTM

crosbymichael added a commit that referenced this pull request May 30, 2014
Fix race conditions
@crosbymichael crosbymichael merged commit 9e58a77 into moby:master May 30, 2014
1 check passed
1 check passed
@samalba
continuous-integration/travis-ci The Travis CI build passed
Details
@LK4D4 LK4D4 deleted the LK4D4:fix_race_conditions branch May 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants