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

IF: Process votes in a dedicated thread pool #24

Merged
merged 42 commits into from
Apr 19, 2024
Merged

Conversation

heifner
Copy link
Member

@heifner heifner commented Apr 11, 2024

Process vote_messages in their own dedicated thread pool. The size of the thread pool is configured by a new chain_plugin config option vote-threads. Vote propagation is disabled by default. Vote threads should be enabled on BPs and on canary nodes between BPs. Votes are required to flow from finalizer nodes to all BPs for finality to advance. vote-threads if not specified is set to 4 on BP nodes.

  --vote-threads arg                    Number of worker threads in vote
                                        processor thread pool. If set to 0,
                                        voting disabled, votes are not
                                        propagatged on P2P network. Defaults to
                                        4 on producer nodes.
  • Report 'Produced block' and 'Received block' known LIB instead of fork db root in Savanna because these log statements used to be called after log_irreversible, but are now called before log_irreversible. To avoid confusion under Savanna, report what the known LIB is instead of what is currently root of the fork db. In legacy mode these will still continue to report the root before the call to log_irreversible; therefore under legacy the updated LIB will be reported one block later.
  • vote_messages are processed first-come-first-serve.

Resolves #3
Resolves #4

@@ -144,7 +144,7 @@ def getSnapshotsCount(nodeId):
while nonProdNode.verifyAlive() and count > 0:
# wait on prodNode 0 since it will continue to advance, since defproducera and defproducerb are its producers
Print("Wait for next block")
assert prodAB.waitForNextBlock(timeout=6), "Production node AB should continue to advance, even after bridge node is killed"
assert prodAB.waitForNextBlock(timeout=10), "Production node AB should continue to advance, even after bridge node is killed"
Copy link
Member Author

Choose a reason for hiding this comment

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

6 seconds is not enough time here. There are three producers A,B,C. If this happens to hit on C's turn to produce then it needs to wait at least 7 seconds for a block to be produced. Bumped up to 10 to give a bit of breathing room.

@@ -1226,7 +1226,7 @@ BOOST_AUTO_TEST_CASE(checktime_pause_block_deadline_not_extended_while_loading_t
// WASM load times on my machine was 35ms.
// Since checktime only kicks in after WASM is loaded this needs to be large enough to load the WASM, but should be
// considerably lower than the 150ms max_transaction_time
BOOST_CHECK_MESSAGE( dur < 50'000, "elapsed " << dur << "us" );
BOOST_CHECK_MESSAGE( dur < 65'000, "elapsed " << dur << "us" );
Copy link
Member Author

Choose a reason for hiding this comment

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

Faild on an asan run. Took 55ms.

libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/controller.cpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
@ericpassmore
Copy link
Contributor

ericpassmore commented Apr 17, 2024

Note:start
group: IF
category: INTERNALS
summary: Process votes in a dedicated thread pool.
Note:end

Copy link
Contributor

@greg7mdp greg7mdp left a comment

Choose a reason for hiding this comment

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

I like it, I think it is simpler and easier to feel confident that it is correct.

libraries/chain/controller.cpp Outdated Show resolved Hide resolved
plugins/net_plugin/net_plugin.cpp Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
libraries/chain/include/eosio/chain/vote_processor.hpp Outdated Show resolved Hide resolved
@heifner heifner requested a review from linh2931 April 18, 2024 21:04
@heifner heifner merged commit 5e5c176 into savanna Apr 19, 2024
36 checks passed
@heifner heifner deleted the GH-3-process-votes branch April 19, 2024 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
5 participants