已关闭
[Bug-Report|缺陷反馈]: 修复 ASAN 场景下 KernelMgr::LoadStaticBinJson 抛异常时卡死的问题 #295
ren-botao创建于  8月4日关闭于  8月4日
ren-botao成员
8月4日 创建

Describe the current behavior / 问题描述

在开启 ASAN(AddressSanitizer)的运行环境下,KernelMgr::LoadStaticBinJson() 加载静态内核配置 JSON 时存在卡死问题。

原实现中,函数在拼装出配置文件路径 configJsonPath<staticKernelBasePath>/static_kernel/ai_core/config/<socPath>/binary_info_config.json)后,直接使用 ifstream f(configJsonPath) 打开文件并调用 nlohmann::json::parse(f) 解析。当该配置文件实际不存在时,文件打开与解析流程在 ASAN 场景下会触发异常并导致进程卡死,无法正常返回。

Environment / 环境信息

  • 运行场景:开启 ASAN(AddressSanitizer)
  • 框架:CANN opbase(aclnn 引擎)
  • 昇腾硬件型号:待补充(代码中通过 OpKernelLib::GetInstance().GetSocPath() 动态获取,无固定型号)

Steps to reproduce the issue / 重现步骤

  1. 在开启 ASAN 的环境下运行使用 aclnn 静态内核加载流程的应用;
  2. 使 KernelMgr::LoadStaticBinJson() 所拼装的配置文件路径 <staticKernelBasePath>/static_kernel/ai_core/config/<socPath>/binary_info_config.json 在文件系统中不存在(例如对应 SoC 的静态内核配置未生成);
  3. 函数执行到 ifstream f(configJsonPath) 及后续 json::parse(f)
  4. 观察到进程在文件打开/解析流程触发异常后卡死,未返回 ACLNN_SUCCESS

Describe the expected behavior / 预期结果

当静态内核配置 JSON 文件不存在时,LoadStaticBinJson() 应能正常返回,不应进入会触发异常并导致进程卡死的文件打开与解析流程。

在 ASAN 场景下复现时,表现为进程卡死于 LoadStaticBinJson 的文件打开与解析流程,无法正常返回。

Special notes for this issue/备注

关联 PR:https://gitcode.com/cann/opbase/pull/689

likedislike
Rren-botao成员
8月4日 添加了label:bug-report
ren-botao成员
8月4日 评论:

/assign @ren-botao

likedislike
CANN-robotCANN-robot成员
8月4日 将 ren-botao 设为负责人
CANN-robotCANN-robot成员
8月4日 关闭了 issue
CANN-robotCANN-robot成员
8月4日 添加了label:resolved