Skip to content

Commit

Permalink
BankingStage - Gossip vote thread always wait (solana-labs#681)
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge authored May 10, 2024
1 parent e621336 commit 878dc96
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/banking_stage/packet_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ impl PacketReceiver {
fn get_receive_timeout(
unprocessed_transaction_storage: &UnprocessedTransactionStorage,
) -> Duration {
// Gossip thread will almost always not wait because the transaction storage will most likely not be empty
if !unprocessed_transaction_storage.is_empty() {
// Gossip thread (does not process) should not continuously receive with 0 duration.
// This can cause the thread to run at 100% CPU because it is continuously polling.
if !unprocessed_transaction_storage.should_not_process()
&& !unprocessed_transaction_storage.is_empty()
{
// If there are buffered packets, run the equivalent of try_recv to try reading more
// packets. This prevents starving BankingStage::consume_buffered_packets due to
// buffered_packet_batches containing transactions that exceed the cost model for
Expand Down

0 comments on commit 878dc96

Please sign in to comment.