Skip to content

Commit

Permalink
Merge branch 'dimitris/hotfix-rc--2024-04-17_23-01' into 'rc--2024-04…
Browse files Browse the repository at this point in the history
…-17_23-01'

fix: move checking heap delta invariant after processing messages in the consensus queue

This MR moves the heap delta invariant check after processing subnet messages. 

See merge request dfinity-lab/public/ic!18878
  • Loading branch information
dsarlis committed Apr 22, 2024
2 parents abcea3e + 9b93f49 commit 687de34
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions rs/execution_environment/src/scheduler.rs
Expand Up @@ -1471,24 +1471,6 @@ impl Scheduler for SchedulerImpl {
self.purge_expired_ingress_messages(&mut state);
}

// See documentation around definition of `heap_delta_estimate` for an
// explanation.
if state.metadata.heap_delta_estimate >= self.config.subnet_heap_delta_capacity {
warn!(
round_log,
"At Round {} @ time {}, current heap delta {} exceeds allowed capacity {}, so not executing any messages.",
current_round,
state.time(),
state.metadata.heap_delta_estimate,
self.config.subnet_heap_delta_capacity
);
self.finish_round(&mut state, current_round_type);
self.metrics
.round_skipped_due_to_current_heap_delta_above_limit
.inc();
return state;
}

// Once the subnet messages are executed in threads, each thread will
// need its own Csprng instance which is initialized with a distinct
// "ExecutionThread". Otherwise, two Csprng instances that are
Expand Down Expand Up @@ -1578,6 +1560,23 @@ impl Scheduler for SchedulerImpl {
}
}
scheduler_round_limits.update_subnet_round_limits(&subnet_round_limits);

// See documentation around definition of `heap_delta_estimate` for an explanation.
if state.metadata.heap_delta_estimate >= self.config.subnet_heap_delta_capacity {
warn!(
round_log,
"At Round {} @ time {}, current heap delta {} exceeds allowed capacity {}, so not executing any messages.",
current_round,
state.time(),
state.metadata.heap_delta_estimate,
self.config.subnet_heap_delta_capacity
);
self.finish_round(&mut state, current_round_type);
self.metrics
.round_skipped_due_to_current_heap_delta_above_limit
.inc();
return state;
}
}

// Execute postponed `raw_rand` subnet messages.
Expand Down

0 comments on commit 687de34

Please sign in to comment.