Skip to content

Commit 46bd20f

Browse files
committed
fix: [hotfix] move checking heap delta invariant after processing messages in the consensus queue
1 parent 02dcaf3 commit 46bd20f

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

rs/execution_environment/src/scheduler.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,24 +1471,6 @@ impl Scheduler for SchedulerImpl {
14711471
self.purge_expired_ingress_messages(&mut state);
14721472
}
14731473

1474-
// See documentation around definition of `heap_delta_estimate` for an
1475-
// explanation.
1476-
if state.metadata.heap_delta_estimate >= self.config.subnet_heap_delta_capacity {
1477-
warn!(
1478-
round_log,
1479-
"At Round {} @ time {}, current heap delta {} exceeds allowed capacity {}, so not executing any messages.",
1480-
current_round,
1481-
state.time(),
1482-
state.metadata.heap_delta_estimate,
1483-
self.config.subnet_heap_delta_capacity
1484-
);
1485-
self.finish_round(&mut state, current_round_type);
1486-
self.metrics
1487-
.round_skipped_due_to_current_heap_delta_above_limit
1488-
.inc();
1489-
return state;
1490-
}
1491-
14921474
// Once the subnet messages are executed in threads, each thread will
14931475
// need its own Csprng instance which is initialized with a distinct
14941476
// "ExecutionThread". Otherwise, two Csprng instances that are
@@ -1578,6 +1560,23 @@ impl Scheduler for SchedulerImpl {
15781560
}
15791561
}
15801562
scheduler_round_limits.update_subnet_round_limits(&subnet_round_limits);
1563+
1564+
// See documentation around definition of `heap_delta_estimate` for an explanation.
1565+
if state.metadata.heap_delta_estimate >= self.config.subnet_heap_delta_capacity {
1566+
warn!(
1567+
round_log,
1568+
"At Round {} @ time {}, current heap delta {} exceeds allowed capacity {}, so not executing any messages.",
1569+
current_round,
1570+
state.time(),
1571+
state.metadata.heap_delta_estimate,
1572+
self.config.subnet_heap_delta_capacity
1573+
);
1574+
self.finish_round(&mut state, current_round_type);
1575+
self.metrics
1576+
.round_skipped_due_to_current_heap_delta_above_limit
1577+
.inc();
1578+
return state;
1579+
}
15811580
}
15821581

15831582
// Execute postponed `raw_rand` subnet messages.

0 commit comments

Comments
 (0)