Skip to content

Commit

Permalink
fix: [EXC-1836] Update hook status after update of canister settings (#…
Browse files Browse the repository at this point in the history
…3624)

The PR adds a check condition for the `low_wasm_memory` hook when
canister settings are updated because changes of `wasm_memory_threshold`
or `wasm_memory_limit` or `memory_allocation` can trigger or un-trigger
hook condition.

---------

Co-authored-by: Adam Bratschi-Kaye <[email protected]>
  • Loading branch information
dragoljub-duric and adambratschikaye authored Jan 31, 2025
1 parent bf5d853 commit ef59572
Show file tree
Hide file tree
Showing 2 changed files with 442 additions and 6 deletions.
10 changes: 8 additions & 2 deletions rs/execution_environment/src/canister_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,9 @@ impl CanisterManager {
if let Some(wasm_memory_limit) = settings.wasm_memory_limit() {
canister.system_state.wasm_memory_limit = Some(wasm_memory_limit);
}
// Change of `wasm_memory_limit` or `new_wasm_memory_threshold` or `memory_allocation`,
// can influence the satisfaction of the condition for `low_wasm_memory` hook.
canister.update_on_low_wasm_memory_hook_condition();
}

/// Tries to apply the requested settings on the canister identified by
Expand Down Expand Up @@ -867,12 +870,15 @@ impl CanisterManager {
);
match dts_result {
DtsInstallCodeResult::Finished {
canister,
mut canister,
call_id: _,
message: _,
instructions_used,
result,
} => (result, instructions_used, Some(canister)),
} => {
canister.update_on_low_wasm_memory_hook_condition();
(result, instructions_used, Some(canister))
}
DtsInstallCodeResult::Paused {
canister: _,
paused_execution,
Expand Down
Loading

0 comments on commit ef59572

Please sign in to comment.