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

rafthttp: fix data races detected by go race detector #3757

Merged
merged 1 commit into from
Oct 27, 2015

Conversation

xiang90
Copy link
Contributor

@xiang90 xiang90 commented Oct 26, 2015

  1. fix the race in the test. fakeWriteFlushCloser is used by multiple routines without locking.
  2. stopped variable has data race. Removing it since the stop logic is actually unnecessary.

wfc.written += len(p)
return len(p), wfc.err
}
func (wfc *fakeWriteFlushCloser) Flush() {}
func (wfc *fakeWriteFlushCloser) Close() error {
wfc.mu.Lock()
defer wfc.mu.Unlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

add one empty line here as Write function does?

@yichengq
Copy link
Contributor

LGTM if it passes race detection.

@jonboulle
Copy link
Contributor

lgtm

xiang90 added a commit that referenced this pull request Oct 27, 2015
rafthttp: fix data races detected by go race detector
@xiang90 xiang90 merged commit 306dd71 into etcd-io:master Oct 27, 2015
@xiang90 xiang90 deleted the race branch October 27, 2015 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

4 participants