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

Fixed data race. #4559

Merged
merged 1 commit into from
Nov 10, 2023
Merged

Fixed data race. #4559

merged 1 commit into from
Nov 10, 2023

Conversation

Frozen
Copy link
Contributor

@Frozen Frozen commented Nov 9, 2023

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

@Frozen Frozen marked this pull request as ready for review November 9, 2023 20:28
@Frozen Frozen self-assigned this Nov 9, 2023
@Frozen Frozen merged commit 6f7a047 into dev Nov 10, 2023
2 checks passed
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")
Copy link
Contributor

Choose a reason for hiding this comment

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

GetLogger() ?

Copy link
Contributor Author

@Frozen Frozen Feb 17, 2024

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

Copy link
Contributor Author

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.

Copy link
Contributor

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()
Copy link
Contributor

Choose a reason for hiding this comment

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

defer?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

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.

2 participants