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 data race #1259
Fix data race #1259
Conversation
consensus/vbft/block_pool.go
Outdated
|
||
// clone a new block | ||
newBlk := &Block{} | ||
if err := newBlk.Deserialize(block.Serialize()); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks too hacky, adding a new proposalSig field in blockProposalMsg to avoid data race.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. But block signatures needs to be updated, and there'll be data race anyway.
You'll have to add lock to block header, or copy a new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this update function is called when the blockPool's lock holds, I do not expect there is any data race left.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No lock when reading signatures in block header, but signature array in block header must be updated.
Either adding locks for all read operations, or just clone a new one when updating then there'll no write ops to block header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blockpool's lock can not protect block headers in proposal message?
ヽ༼ຈʖ̯ຈ༽ノ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
bfbd3b9
to
db22601
Compare
No description provided.