Closed
[Bug-Report|缺陷反馈]:Async queue event handling can leak a dequeued mbuf #1351
KaranocaVeAdd on 18 days agoClosed at 1 day ago
18 days ago Associated pull request
18 days ago Modify description of issue
18 days ago Modify description of issue
18 days ago Modify description of issue
18 days ago Modify description of issue
duanpengliang
18 days ago Comments:
18 days ago Comments:
初步分析,当前代码已修正双队列共用出队结果导致的 mbuf 丢失。无触发标志时仍会分配事件缓冲并返回成功,但既未入队也未释放,重复进入该分支会累积未释放内存。两个触发标志仍由不同线程直接读写,事件处理结果也未区分是否实际处理。
已有相关 PR !6197,后续将结合现有修正核对剩余资源释放、并发通知和返回值语义,补齐对应验证。


18 days ago Assign KaranocaVe、xiao_cun as responsible person
8 days ago Assign jia_shaoyang as responsible person
贾绍扬
7 days ago Comments:
7 days ago Comments:
@KaranocaVe 你好,我在 Issue #1351 关联的这个 PR 中提了 3 条检视意见,涉及 ST 编译、出队异常后的待处理状态恢复,以及 UT mock 的重载匹配和调用次数校验。
麻烦逐条确认并处理,修改后补充验证结果,再 @我复审。如对某条意见有不同看法,也请在对应讨论中说明,便于一起确认。谢谢!


7 days ago Added label: wait-feedback
3 days ago Change title to "[Bug-Report|缺陷反馈]Async queue event handling can leak a dequeued mbuf", originally titled "Async queue event handling can leak a dequeued mbuf".
3 days ago Change title to "[Bug-Report|缺陷反馈]Async queue event handling can leak a dequeued mbuf", originally titled "Async queue event handling can leak a dequeued mbuf".
3 days ago Change title to "[Bug-Report|缺陷反馈]:Async queue event handling can leak a dequeued mbuf", originally titled "[Bug-Report|缺陷反馈]Async queue event handling can leak a dequeued mbuf".
3 days ago Change title to "[Bug-Report|缺陷反馈]:Async queue event handling can leak a dequeued mbuf", originally titled "[Bug-Report|缺陷反馈]Async queue event handling can leak a dequeued mbuf".
CANN-robot
3 days ago Comments:
3 days ago Comments:
提交内容规范性检查:未通过
原因:部分匹配现有模板
此 Issue 已使用 Bug-Report|缺陷反馈 模板,但仍有以下未匹配项:
- Describe the current behavior / 问题描述 (Mandatory / 必填):缺少此必填章节
- Environment / 环境信息 (Mandatory / 必填):缺少此必填章节
- Steps to reproduce the issue / 重现步骤 (Mandatory / 必填):缺少此必填章节
- Describe the expected behavior / 预期结果 (Mandatory / 必填):缺少此必填章节
- Related log / screenshot / 日志 / 截图 (Mandatory / 必填):缺少此必填章节
模板完善建议:Bug-Report|缺陷反馈
展开显示模板内容,将模板内容复制到 Issue 中填写。
模板正文(Markdown)
### Describe the current behavior / 问题描述 (Mandatory / 必填)
<!-- 必填
提供尽可能多的信息描述产生了什么问题 -->
### Environment / 环境信息 (Mandatory / 必填)
<!-- 必填
请提供昇腾硬件型号与软件环境信息 -->
### Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
<!-- 必填
提供尽可能多的信息描述如何重现该缺陷 -->
### Describe the expected behavior / 预期结果 (Mandatory / 必填)
<!-- 必填
描述期望的行为应该是什么样子的 -->
### Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
<!-- 必填
提供尽可能多的日志/结果信息 -->
### Special notes for this issue/备注 (Optional / 选填)
<!-- 选填
补充下其他您认为需要提供的信息 -->


2 days ago Modify description of issue
CANN-robot
2 days ago Comments:
2 days ago Comments:
1 day ago Associated pull request
贾绍扬
1 day ago Comments:
1 day ago Comments:
你好,pr已合入,issue关闭处理,感谢贡献


1 day ago changed custom state from 待办的 to 已解决
1 day ago Close issue
22 hours ago Added label: resolved
Describe the current behavior / 问题描述 (Mandatory / 必填)
CANN Runtime 队列调度模块分别使用两个异步内存事件队列处理客户端出队和入队通知。修复前存在以下 mbuf 泄漏场景:
客户端入队和出队通过独立的异步线程执行,可能在调度器处理事件前同时设置两个触发标志。重复触发上述场景会导致驱动侧未释放的 mbuf 持续累积。
Environment / 环境信息 (Mandatory / 必填)
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
场景一:两个异步队列同时触发
场景二:无异步队列启用
Describe the expected behavior / 预期结果 (Mandatory / 必填)
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
原 Issue 记录的验证结果:
outcome: confirmed_bug
Host 侧已复现两个异步队列同时触发时的 mbuf 丢失问题。
修复后验证了两个队列独立出队、释放及无触发队列场景。
受影响单元测试:50/50 通过。
完整队列调度单元测试程序:697/697 通过,共 25 个测试套件。
原始记录未附具体测试日志或截图。
Special notes for this issue/备注 (Optional / 选填)
修复采用原子触发标志,独立处理两个异步队列,并为每次出队使用新的 mbuf 指针,避免出队结果相互覆盖。同时完善无触发队列时的资源处理及实际处理状态返回,保留既有入队失败处理逻辑。
关联 PR:https://gitcode.com/cann/runtime/merge_requests/6197