Skip to content
This repository has been archived by the owner on Sep 6, 2018. It is now read-only.

Fix data race #123

Merged
merged 3 commits into from
Nov 6, 2013
Merged

Fix data race #123

merged 3 commits into from
Nov 6, 2013

Conversation

xiang90
Copy link
Contributor

@xiang90 xiang90 commented Oct 22, 2013

Fix data race.
The major fix is to clone the requests before sending them to different raft server.

@xiang90
Copy link
Contributor Author

xiang90 commented Oct 22, 2013

@benbjohnson This should fix #100.

@erikstmartin
Copy link

Awesome! Thanks Xiang, I was going to start peeking at it today 👍 :)

@xiang90
Copy link
Contributor Author

xiang90 commented Oct 31, 2013

@benbjohnson Maybe we can merge this?

@benbjohnson
Copy link
Contributor

@xiangli-cmu Sorry I didn't get to this sooner. Two points of feedback:

  1. I don't think we should expose setTerm() on an interface just for tests. Can you manually call s.(*server).mutex.Lock() in the tests instead and remove the setTerm() function? It's also strange because the initial-lowercase name will cause the function to not be exportable. I'm actually not sure how that would even work in Go.
  2. I'm still seeing a data race for event#returnValue. Can you wrap this in a getter/setter function with a lock? Here's the race condition report: https://gist.github.com/benbjohnson/763b7e55fa8f59244ba5

@xiang90
Copy link
Contributor Author

xiang90 commented Nov 6, 2013

@benbjohnson For the second, I cannot understand it. I think it is already synced by the channel...
I will merge this.

xiang90 added a commit that referenced this pull request Nov 6, 2013
@xiang90 xiang90 merged commit ed68a07 into master Nov 6, 2013
@benbjohnson benbjohnson deleted the fix-data-race branch November 8, 2013 21:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants