Skip to content

Commit 9029d26

Browse files
mraszykCopilot
andauthored
feat: responses might be executed before canister_on_low_wasm_memory (#271)
This PR specifies that responses might still be executed after the condition for `canister_on_low_wasm_memory` is triggered and before the function `canister_on_low_wasm_memory` is actually executed. --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent ee319c3 commit 9029d26

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

docs/references/ic-interface-spec/abstract-behavior.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1245,14 +1245,15 @@ Conditions
12451245
S.messages = Older_messages · FuncMessage M · Younger_messages
12461246
(M.queue = Unordered) or (∀ CallMessage M' | FuncMessage M' ∈ Older_messages. M'.queue ≠ M.queue)
12471247
(∀ FuncMessage M' ∈ Older_messages · Younger_messages. M'.receiver ≠ M.receiver or M.entry_point ≠ OnLowWasmMemory)
1248-
S.on_low_wasm_memory_hook_status[M.receiver] ≠ Ready
12491248
S.canisters[M.receiver] ≠ EmptyCanister
12501249
Mod = S.canisters[M.receiver].module
12511250
Ctxt = S.call_contexts[M.call_context]
12521251
Deadline = deadline_of_context(Ctxt)
12531252

12541253
Is_response = M.entry_point == Callback _ _ _
12551254

1255+
S.on_low_wasm_memory_hook_status[M.receiver] ≠ Ready or Is_response
1256+
12561257
Env = {
12571258
time = S.time[M.receiver];
12581259
controllers = S.controllers[M.receiver];

docs/references/ic-interface-spec/canister-interface.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ The threshold `t` can be defined in the field `wasm_memory_threshold` in the [ca
179179
:::note
180180

181181
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.
182-
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`.
182+
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`.
183+
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.
184+
183185
:::
184186

185187
#### Callbacks

docs/references/ic-interface-spec/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ sidebar:
88

99
## Changelog {#changelog}
1010

11+
### 0.62.0 (2025-05-26) {$0_62_0}
12+
* Inter-canister response callback messages might still be executed after the condition for `canister_on_low_wasm_memory` is triggered
13+
and before the function `canister_on_low_wasm_memory` is executed.
14+
1115
### 0.61.0 (2025-05-18) {$0_61_0}
1216
* New management canister endpoint `canister_metrics`.
1317

0 commit comments

Comments
 (0)