I deployed a canister seven days ago and verified that all API endpoints were functioning correctly. However, after reaching 42 users, the canister started failing when calling the create_an_account
API, while all other endpoints remained smooth. The error message indicates an IC0503 (Reject code: 5), stating that the canister panicked due to attempting to allocate an already allocated chunk in the ic-stable-structures
library. The issue likely stems from improper memory allocation or a flaw in handling storage within the stable structures, causing the system to trap. The create_an_account
API accepts a detailed user profile with multiple fields, and the failure suggests that adding new accounts is exceeding the canister’s memory or violating allocation constraints. Reviewing how memory allocation and stable storage management are handled in the canister is necessary to resolve this.
Call failed:
Canister: o2nha-xaaaa-aaaak-qt6fq-cai
Method: create_an_account (update)
"Request ID": "e931c94d0c0a36a62f4e1c255470edfd5a155b23d513cf5e5ca7134f93b30dc7"
"Error code": "IC0503"
"Reject code": "5"
"Reject message": "Error from Canister o2nha-xaaaa-aaaak-qt6fq-cai: Canister called `ic0.trap` with message: 'Panicked at 'Attempting to allocate an already allocated chunk.', /home/yash/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ic-stable-structures-0.6.7/src/btreemap/allocator.rs:166:9'.\nConsider gracefully handling failures from this canister or altering the canister to handle exceptions. See documentation: https://internetcomputer.org/docs/current/references/execution-errors#trapped-explicitly"