Skip to content

Commit

Permalink
Fix false positive "State advance too slow" logs (#2218)
Browse files Browse the repository at this point in the history
## Issue Addressed

- Resolves #2214

## Proposed Changes

Fix the false positive warning log described in #2214.

## Additional Info

NA
  • Loading branch information
paulhauner committed Feb 21, 2021
1 parent 8949ae7 commit 4362ea4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions beacon_node/beacon_chain/src/state_advance_timer.rs
Expand Up @@ -286,15 +286,23 @@ fn advance_head<T: BeaconChainTypes>(
.update_pre_state(head_root, state)
.ok_or(Error::HeadMissingFromSnapshotCache(head_root))?;

// If we have moved into the next slot whilst processing the state then this function is going
// to become ineffective and likely become a hindrance as we're stealing the tree hash cache
// from the snapshot cache (which may force the next block to rebuild a new one).
//
// If this warning occurs very frequently on well-resourced machines then we should consider
// starting it earlier in the slot. Otherwise, it's a good indication that the machine is too
// slow/overloaded and will be useful information for the user.
let starting_slot = current_slot;
let current_slot = beacon_chain.slot()?;
if final_slot <= current_slot {
if starting_slot < current_slot {
warn!(
log,
"State advance too slow";
"head_root" => %head_root,
"advanced_slot" => final_slot,
"current_slot" => current_slot,
"initial_slot" => initial_slot,
"starting_slot" => starting_slot,
"msg" => "system resources may be overloaded",
);
}
Expand Down

0 comments on commit 4362ea4

Please sign in to comment.