-
Notifications
You must be signed in to change notification settings - Fork 291
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
Fixed data race. #4559
Fixed data race. #4559
Conversation
return | ||
} | ||
} | ||
|
||
consensus.mutex.Lock() | ||
consensus.getLogger().Info().Msg("[preCommitAndPropose] Start consensus timer") | ||
consensus.consensusTimeout[timeoutConsensus].Start() | ||
|
||
// Send signal to Node to propose the new block for consensus | ||
consensus.getLogger().Info().Msg("[preCommitAndPropose] sending block proposal signal") |
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.
GetLogger() ?
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, we obtained lock above on line 584
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.
GetLogger() has lock inside, so it will be deadlock.
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.
GetLogger is a public function, it should be improved to not have such a constraints. We can't make a function public and ask users to not use it in a certain conditions, right?
consensus.getLogger().Info().Msg("[preCommitAndPropose] Start consensus timer") | ||
consensus.consensusTimeout[timeoutConsensus].Start() | ||
|
||
// Send signal to Node to propose the new block for consensus | ||
consensus.getLogger().Info().Msg("[preCommitAndPropose] sending block proposal signal") | ||
|
||
consensus.mutex.Unlock() |
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.
defer?
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, we release lock exactly here.
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.
to excludes line consensus.ReadySignal(AsyncProposal)
? any reason for that?
This PR contain fixes for 4 data races i've found during testing devnet with enabled race detector. This PR arrives after we first time faced
block exists
error, which looks like the concurrency issue.#4558
#4557
#4556
#4555