已合并
fix(kernel_mgr): 修复 ASAN 场景下 LoadStaticBinJson 抛异常时卡死的问题 #689
fix(kernel_mgr): 修复 ASAN 场景下 LoadStaticBinJson 抛异常时卡死的问题 #689
已合并
ren-botao创建于 7月31日
ren-botao成员
7月31日

描述

修复 ASAN 场景下 KernelMgr::LoadStaticBinJson() 在静态内核配置 JSON 文件不存在时,文件打开与解析流程触发异常导致进程卡死的问题。改动在打开配置文件前先通过 RealPath(configJsonPath) 校验路径,文件不存在时打印告警并提前返回 ACLNN_SUCCESS,绕开会触发异常的文件打开与解析流程。

关联的Issue

#295 修复 ASAN 场景下 KernelMgr::LoadStaticBinJson 抛异常时卡死的问题

测试

冒烟、端到端验证ASAN场景下是否还会卡死

文档更新

不涉及

类型标签

likedislike
Pull Request已成功合入, 合并人@CANN-robot
(感谢 ren-botao 的贡献)
Rren-botao成员
7月31日 创建了 pull request,commit a65f9095
atomgit-bot
atomgit-bot
7月31日 评论:

变更摘要

本 PR 主要修复 ASAN 场景下 KernelMgr::LoadStaticBinJson 抛异常时卡死的问题。改动在打开静态内核配置 JSON 文件前,先通过 RealPath(configJsonPath) 校验路径并解析出真实路径,当文件不存在时打印告警并提前返回 ACCLNN_SUCCESS,从而绕开可能触发异常并导致卡死的文件打开与解析流程;同时将 ifstream 改为使用真实路径打开,并将局部变量由 string 统一规范为 std::string。

主要改动

  • 新增真实路径校验:在打开配置文件前新增 std::string realConfigJsonPath = RealPath(configJsonPath),提前确认配置 JSON 路径有效性,避免 ASAN 场景下抛异常导致卡死。
  • 路径不存在时提前返回:通过 OP_CHECK 判断 realConfigJsonPath 为空时打印告警日志并直接返回 ACCLNN_SUCCESS,不再进入 nlohmann::json::parse 的文件读取流程。
  • 改用真实路径打开文件:将 ifstream f(configJsonPath) 改为 ifstream f(realConfigJsonPath),日志中输出的路径也同步改为 realConfigJsonPath.c_str()。
  • 类型规范化:将 staticKernelBasePath、configJsonPath 两个局部变量的声明由 string 改为 std::string。
likedislike
不准确?
atomgit-bot
atomgit-bot
7月31日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
CANN-robotCANN-robot成员
7月31日 添加了label:cann-cla/yes
CANN-robot
CANN-robot成员
7月31日 评论:

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


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/opbase ✅ 宋恺, 张磊 (2/2) ✅ 宋恺, 张磊 (2/1)

💡 Tip:

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

CLA Signature Pass

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

likedislike
CANN-robotCANN-robot成员
7月31日 将zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng设为评审人
CANN-robotCANN-robot成员
7月31日 将zhou-qilong,wangrui_,rxtfeng,loov1,jia0liang,zl_hw,songkai111,pingchuantang,llimwang,gubaocheng设为审查人
Rren-botao成员
8月4日 修改标题为 “fix(kernel_mgr): 修复 ASAN 场景下 LoadStaticBinJson 抛异常时卡死的问题”,原标题为“修改ASAN场景下LoadStaticBinJson中抛异常时卡死的问题”
Rren-botao成员
8月4日 修改了pull request 的描述
ren-botao成员
8月4日 评论:

compile

likedislike
Rren-botao成员
8月4日 预合并成功(commit_id: 540fbf1eb962a4a263726c96d1e0af1a59f9d1b7)
CANN-robotCANN-robot成员
8月4日 添加了label:ci-pipeline-running
CANN-robot
CANN-robot成员
8月4日 评论:

流水线任务触发成功
任务链接 [aaeb1ace755746daab04495a5f60d627][流水线指导]

任务名称状态日志下载链接
codecheck ✅ SUCCESS >>>>>
SCA ✅ SUCCESS >>>>>
antipoison ✅ SUCCESS >>>>>
Check_Pr ✅ SUCCESS >>>>>
Compile_Ascend_X86_ubuntu24 ✅ SUCCESS >>>>> >>>>>
UT_Test ✅ SUCCESS
Compile_Ascend_ARM_ubuntu24 ✅ SUCCESS >>>>> >>>>>
pre_comment ✅ SUCCESS >>>>>
StaticCheck_codespell ✅ SUCCESS
StaticCheck_link_validity ✅ SUCCESS
StaticCheck_resource_existence ✅ SUCCESS
StaticCheck_tag_closed ✅ SUCCESS
StaticCheck_markdownlint ✅ SUCCESS
codecheck_style ✅ SUCCESS >>>>>
precommit ✅ SUCCESS >>>>>
API_Check ✅ SUCCESS >>>>>

[2026-08-04 09:48:16]    CI执行结束

likedislike
CANN-robotCANN-robot成员
8月4日 添加了label:api-check-pass
CANN-robotCANN-robot成员
8月4日 删除了label:ci-pipeline-running
CANN-robotCANN-robot成员
8月4日 添加了label:ci-pipeline-passed
CANN-robot
CANN-robot成员
8月4日 评论:
流水线 PR-pipeline_cann_opbase#1594 [ commitID:5d3cfbbd ] 已完成
likedislike
Rren-botao成员
8月4日 修改了pull request 的描述
songkai111成员
8月4日 评论:

/approve

likedislike
CANN-robotCANN-robot成员
8月4日 添加了label:approved
zl_hw成员
8月4日 评论:

/lgtm
/approve

likedislike
CANN-robotCANN-robot成员
8月4日 添加了label:lgtm
CANN-robotCANN-robot成员
8月4日 关闭了关联的issue
CANN-robotCANN-robot成员
8月4日 合入了pull request