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 data race when calling get metadata #562

Merged
merged 3 commits into from
Aug 26, 2023
Merged

Fix data race when calling get metadata #562

merged 3 commits into from
Aug 26, 2023

Conversation

pfi79
Copy link
Contributor

@pfi79 pfi79 commented Aug 25, 2023

No description provided.

The leader after a restart would grab the leader token and wait for a non-empty batch.
In the new test the view thread of the leader after the restart is just about to call controller decide.
However, before the provided fix, the controller is busy waiting for a new batch.
Without any new transactions, the leader is stuck.
In the fix, if the new batch is empty, the controller continues while reacquiring the leader token, thus allowing the view to call decide.

Signed-off-by: Фёдор Партанский <[email protected]>
The leader after a restart would grab the leader token and propose while also calling GetMetadata.
In the test the view thread of the leader after the restart is just about to call startNextSeq.
This causes a data race.
In the fix, the leader token is acquired only when the view is not in the middle of a decisionFix data race when calling GetMetadata.

Signed-off-by: Фёдор Партанский <[email protected]>
@pfi79 pfi79 requested a review from C0rWin August 25, 2023 12:38
@pfi79 pfi79 merged commit cd14de6 into hyperledger-labs:v2 Aug 26, 2023
3 checks passed
@pfi79 pfi79 deleted the fix-data-race-when-calling-get-metadata branch August 26, 2023 23:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants