已开启
Destroy Endpoint channels when configuration cleanup fails #241
Destroy Endpoint channels when configuration cleanup fails #241
已开启
KaranocaVe创建于 1 天前
KaranocaVe
KaranocaVe
1 天前

Destroy Endpoint channels when configuration cleanup fails

When HcommChannelCreateWithConfig succeeds but HcommChannelConfigDestroy fails, the Endpoint MakeMultiChannelHandle path returns an error without destroying the channels and without returning a handle. The caller cannot release those channels.

Attempt HcommChannelDestroy on this failure path, log a secondary cleanup error, and preserve the configuration-destroy result. The focused Host regression probe passes the injected configuration-destroy failure, an injected channel-cleanup failure, and the normal create/destroy control.

关联 Issue: https://gitcode.com/cann/asc-comm/issues/59

likedislike
合并受阻
KaranocaVeKaranocaVe
1 天前 创建了 pull request,commit 632d14ae
KaranocaVeKaranocaVe
1 天前 关联了issue:Endpoint multi-channel creation can leak channels after config cleanup fails
atomgit-bot
atomgit-bot
1 天前 评论:

变更摘要

本 PR 修复 HcommCreateSharedChannels 在通道创建成功后配置销毁失败的资源泄漏问题。改动位于 src/aicore/hcomm/host/hcomm_host_impl.h:原先该函数直接返回 DestroyChannelConfig 的结果,一旦 HcommChannelConfigDestroy 失败便直接返回错误,已创建的 channels 无法被释放。现在改为在配置销毁失败时尝试调用 HcommChannelDestroy 释放 channels,并对二级清理失败记录日志,同时保留配置销毁的原始返回值作为最终结果。

主要改动

  • 配置销毁结果改为显式保存: 将 DestroyChannelConfig(config, DlHcommApi::HcommChannelConfigDestroy, "HcommChannelConfigDestroy") 的返回值保存到 destroyRet,不再直接作为函数返回值。
  • 失败路径新增通道清理: 当 destroyRet != HCCL_SUCCESS 时,调用 DlHcommApi::HcommChannelDestroy(channels, channelNum) 尝试销毁已创建的 channels,避免句柄泄漏。
  • 二级清理失败日志: 若 HcommChannelDestroy 同样未返回 HCCL_SUCCESS,通过 ASC_CPU_LOG_ERROR 以 [ERROR] [%s] cleanup HcommChannelDestroy failed, ret[%d]. 格式记录该清理错误及返回码。
  • 返回值语义保持: 清理分支最终仍返回原始的 destroyRet,成功路径则显式返回 HCCL_SUCCESS,保持配置销毁失败结果不被覆盖。
likedislike
不准确?
atomgit-bot
atomgit-bot
1 天前 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
1 天前 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
1 天前 评论:

Thanks for your pull-request.
The full list of commands accepted by me can be found at here.
You can get sig-info at here.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
For more, you also can visit HICANN.


PR Approval Progress

⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)

Module Approval Details

module lgtm status approve status
src ❌ (0/2)(You can also ask: bluesky901, zhanghao_0689, qin437231, 黄金华, 诸葛洵) ❌ (0/1)(You can also ask: chenma, 石楠翔, 肖婷, 苏建加, changxianyu)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)
likedislike
CANN-robot
CANN-robot成员
1 天前 评论:

CLA Signature Pass

KaranocaVe, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
KaranocaVe
KaranocaVe
1 天前 评论:

/compile

likedislike
KaranocaVeKaranocaVe
1 天前 预合并成功(commit_id: 46c72f148537bf12239dbf75d661d84098c63f30)
CANN-robot
CANN-robot成员
1 天前 评论:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robot成员
1 天前 添加了label:ci-pipeline-running
CANN-robotCANN-robot成员
1 天前 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
1 天前 添加了label:ci-pipeline-passed