From aa0e95a316b363d0bb9e45cf0767006a28090c4a Mon Sep 17 00:00:00 2001 From: Martin Raszyk Date: Fri, 22 May 2026 09:45:09 +0200 Subject: [PATCH 1/2] feat: responses might be executed before canister_on_low_wasm_memory --- docs/references/ic-interface-spec/abstract-behavior.md | 3 ++- docs/references/ic-interface-spec/canister-interface.md | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/references/ic-interface-spec/abstract-behavior.md b/docs/references/ic-interface-spec/abstract-behavior.md index fbf6e57..0961d2e 100644 --- a/docs/references/ic-interface-spec/abstract-behavior.md +++ b/docs/references/ic-interface-spec/abstract-behavior.md @@ -1245,7 +1245,6 @@ Conditions S.messages = Older_messages · FuncMessage M · Younger_messages (M.queue = Unordered) or (∀ CallMessage M' | FuncMessage M' ∈ Older_messages. M'.queue ≠ M.queue) (∀ FuncMessage M' ∈ Older_messages · Younger_messages. M'.receiver ≠ M.receiver or M.entry_point ≠ OnLowWasmMemory) -S.on_low_wasm_memory_hook_status[M.receiver] ≠ Ready S.canisters[M.receiver] ≠ EmptyCanister Mod = S.canisters[M.receiver].module Ctxt = S.call_contexts[M.call_context] @@ -1253,6 +1252,8 @@ Deadline = deadline_of_context(Ctxt) Is_response = M.entry_point == Callback _ _ _ +S.on_low_wasm_memory_hook_status[M.receiver] ≠ Ready or Is_response + Env = { time = S.time[M.receiver]; controllers = S.controllers[M.receiver]; diff --git a/docs/references/ic-interface-spec/canister-interface.md b/docs/references/ic-interface-spec/canister-interface.md index 2e0f050..896745c 100644 --- a/docs/references/ic-interface-spec/canister-interface.md +++ b/docs/references/ic-interface-spec/canister-interface.md @@ -180,6 +180,8 @@ The threshold `t` can be defined in the field `wasm_memory_threshold` in the [ca While the above function is scheduled immediately once the condition above is triggered, it may not necessarily be executed immediately if the canister does not have enough cycles. If the canister gets frozen immediately after the function is scheduled for execution, the function will run once the canister's unfrozen _if_ the canister's remaining wasm memory size in bytes remains strictly less than the threshold `t`. +In particular, responses might still be executed after the condition is triggered and before the function `canister_on_low_wasm_memory` is executed. + ::: #### Callbacks From 4c9e9c35897a424ca76158c64c1d02a7e7fd9859 Mon Sep 17 00:00:00 2001 From: mraszyk <31483726+mraszyk@users.noreply.github.com> Date: Fri, 22 May 2026 13:47:56 +0200 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/references/ic-interface-spec/canister-interface.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/references/ic-interface-spec/canister-interface.md b/docs/references/ic-interface-spec/canister-interface.md index 896745c..4617b98 100644 --- a/docs/references/ic-interface-spec/canister-interface.md +++ b/docs/references/ic-interface-spec/canister-interface.md @@ -179,8 +179,8 @@ The threshold `t` can be defined in the field `wasm_memory_threshold` in the [ca :::note While the above function is scheduled immediately once the condition above is triggered, it may not necessarily be executed immediately if the canister does not have enough cycles. -If the canister gets frozen immediately after the function is scheduled for execution, the function will run once the canister's unfrozen _if_ the canister's remaining wasm memory size in bytes remains strictly less than the threshold `t`. -In particular, responses might still be executed after the condition is triggered and before the function `canister_on_low_wasm_memory` is executed. +If the canister gets frozen immediately after the function is scheduled for execution, the function will run once the canister is unfrozen _if_ the canister's remaining wasm memory size in bytes remains strictly less than the threshold `t`. +In particular, inter-canister response callback messages might still be executed after the condition is triggered and before the function `canister_on_low_wasm_memory` is executed. :::