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

Remove shutdown latch from BftProcessor #3478

Closed

Conversation

siladu
Copy link
Contributor

@siladu siladu commented Feb 22, 2022

We don't want BftMiningCoordinator.stop() to wait for BftProcessor to shutdown before calling shutdown on the BftExecutor.
This prevents BftMiningCoordinator from being able to be shutdown from the same thread.
We want to enable shutdown from the same thread to support migrating from one MiningCoordinator instance to another (IBFT -> QBFT).

This is the relevant discussion as to why the latch was originally added in: #104 (comment)

I believe the latch is unnecessary because BftExecutors.stop() (which calls bftProcessExecutor.shutdownNow) should be sufficient to safely prevent any further tasks from being accepted, whilst BftExecutors.awaitStop() (calling bftProcessExecutor.awaitTermination()) gives the current task(s) a chance to finish.

This PR is most if not all of the solution to #3003

We don't want BftMiningCoordinator.stop() to wait for BftProcessor to shutdown before calling shutdown on the BftExecutor.
This prevents BftMiningCoordinator from being able to be shutdown from the same thread.
We want to enable shutdown from the same thread to support migrating from one miningCoordinator instance to another (IBFT -> QBFT).

Signed-off-by: Simon Dudley <[email protected]>
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@siladu siladu removed the TeamGroot GH issues worked on by Groot Team label Feb 23, 2022
@siladu
Copy link
Contributor Author

siladu commented Feb 23, 2022

Closing this in favour of #3438

Although we probably don't need the latch for the 'shutdown besu' scenario, it doesn't fully solve the QBFT migration scenario. It was only worth risking this change if it was going to help resolve #3003 but I don't think it's possible to safely shutdown the bftProcessor/Executor from its own thread, we need another thread to manage this safely.

@siladu siladu closed this Feb 23, 2022
@siladu siladu deleted the remove-bftprocessor-shutdown-latch branch February 23, 2022 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant