How to verify wasm_memory_threshold is set correctly?

I am playing around with canister_on_low_wasm_memory and I’m trying to set the wasm memory threshold with dfx canister create as per dfx canister | Internet Computer but I get the following error

$ dfx canister create myCanister --no-wallet --wasm-memory-limit 840210069 --wasm-memory-threshold 663765954
error: unexpected argument '--wasm-memory-threshold' found

  tip: a similar argument exists: '--wasm-memory-limit'

Usage: dfx canister create --no-wallet <CANISTER_NAME>

For more information, try '--help'.
$ dfx --version
dfx 0.24.3

Setting the threshold in the dfx.json seems to work in so far as it will create the canister, but I don’t see any any verification of the threshold being set in dfx canister status.

$ dfx canister status canister
Canister status call result for canister.
Status: Running
Memory allocation: 0
Compute allocation: 0
Freezing threshold: 2_592_000
Idle cycles burned per day: 966_906_148
Memory Size: Nat(1230014074)
Balance: 99_995_539_183_442 Cycles
Reserved: 0 Cycles
Reserved cycles limit: 5_000_000_000_000 Cycles
Wasm memory limit: 840_210_069 Bytes
Module hash: 0x572464958e291223aec48094922296ed846b506dc9329f174d073bfd0249ffb9
Number of queries: 0
Instructions spent in queries: 0
Total query request payload size (bytes): 0
Total query response payload size (bytes): 0
Log visibility: controllers

And canister_on_low_wasm_memory seems to be called as the memory crosses the wasm_memory_limit and not in the window created by the threshold and the limit as it seems to be described.

Am I misunderstanding how wasm_memory_threshold is supposed to work, or is this a limitation of dfx? Any insights would be appreciated!

2 Likes

dfx does not support wasm_memory_threshold yet. I see the spec PR is still open. @mraszyk how safe is it for dfx to add support for wasm_memory_threshold? Any risk that the API still changes substantially?

3 Likes

I don’t expect the API to change, but the spec PR is still open since the implementation of the feature has some known issues that are not yet fixed, see this PR for an example.

4 Likes