Hi,
i’m using PocketIC to test my rust based canister. I get a panicked but it doesn’t actually break the test. everything completes as normal. Wondering if this is something to be concerned about?
2024-08-18 22:42:10.970410511 UTC: [Canister a2cb4-hh777-77775-aaaba-cai] here in loop : Principal { len: 10, bytes: [255, 255, 255, 255, 255, 160, 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
2024-08-18 22:42:10.970410512 UTC: [Canister a2cb4-hh777-77775-aaaba-cai] Panicked at 'Arc counter overflow', /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/sync.rs:2843:13
2024-08-18 22:42:10.970410512 UTC: [Canister a2cb4-hh777-77775-aaaba-cai] Panicked at 'Arc counter overflow', /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/sync.rs:2843:13
2024-08-18 22:42:10.970410513 UTC: [Canister a2cb4-hh777-77775-aaaba-cai] here in loop : Principal { len: 10, bytes: [255, 255, 255, 255, 255, 160, 0, 4, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
This error seems to happen when I upgrade my archive canisters from inside the main canister
pub async fn update_archive_canisters() -> Result<(), String> {
let archive_canisters = read_state(|s| s.data.swaps.get_archive_canisters());
let version = read_state(|s| s.data.version.clone());
let test_mode = read_state(|s| s.env.is_test_mode());
let mut current_auth_prins = read_state(|s| s.data.authorized_principals.clone());
let this_canister_id = read_state(|s| s.env.canister_id());
current_auth_prins.push(this_canister_id);
trace(&format!("SWAP Canister :: init args version {}", version));
let init_args = match
Encode!(
&(InitArgArchive {
authorized_principals: current_auth_prins,
test_mode: test_mode,
version: version,
})
)
{
Ok(encoded_init_args) => encoded_init_args,
Err(e) => {
return Err(format!("ERROR : failed to create init args with error - {e}"));
}
};
trace(&format!("here 1"));
for archive in archive_canisters {
let init_args = init_args.clone();
let install_args = InstallCodeArgument {
mode: CanisterInstallMode::Upgrade(None),
canister_id: archive.canister_id,
wasm_module: ARCHIVE_WASM.to_vec().clone(),
arg: init_args.clone(),
};
trace(&format!("here in loop : {:?}", archive.canister_id));
match install_code(install_args).await {
Ok(()) => {
debug!("SUCCESS : archive canister upgraded");
}
Err((code, msg)) => {
trace(&format!("ERROR upgrading archive canister : {code:?} - {msg}"));
ic_cdk::println!(
"ERROR : failed to install canister code for arhcive canister with error : {} - {}",
code as i32,
msg
);
}
}
}
Ok(())
}