已开启
Endpoint multi-channel creation can leak channels after config cleanup fails #59
KaranocaVe创建于  8 天前
KaranocaVe
KaranocaVe
8 天前 创建

Endpoint multi-channel creation can leak channels after config cleanup fails

HcommCreateSharedChannels creates channels and then destroys their temporary configuration. If configuration destruction fails, it returns the error without destroying the channels it just created. The Endpoint overload then returns an error with a zero output handle, leaving the caller no way to release those channels.

Repeated failures can retain Endpoint-owned channel resources. The fix attempts channel cleanup on this error path, logs a secondary cleanup failure, and preserves the original configuration-destroy error.

Validation

A focused Host probe compiles the production hcomm_host_impl.h path with test doubles for ACL memory operations and the Hcomm API boundary. It injects failure in configuration destruction and channel cleanup, plus a normal create/destroy control.

On the baseline, the injected configuration-destroy failure returned HCCL_E_RUNTIME with a zero output handle and no channel-destroy calls. With the fix, both failure cases call channel cleanup once and retain the original HCCL_E_RUNTIME; the normal control still succeeds and destroys its channel once.

Checks on src/aicore/hcomm/host/hcomm_host_impl.h passed: git diff --check, clang-format --dry-run --Werror, and pre-commit run --files src/aicore/hcomm/host/hcomm_host_impl.h. The target pre-commit hook uses clang-format 18.1.8; formatting, codespell, and OAT checks passed. Full repository build and device tests were not run.

关联 PR: https://gitcode.com/cann/asc-comm/merge_requests/241

likedislike
KaranocaVeKaranocaVe
8 天前 关联了pull request:Destroy Endpoint channels when configuration cleanup fails
KaranocaVeKaranocaVe
8 天前 修改了issue 的描述
Llittle_apple_12
4 天前 关联了pull request:docs(ain): 更正 AinBarrierSession::Sync 的 order 参数说明