已关闭
[Bug-Report|缺陷反馈]: g_allocated_ptr 操作无锁保护存在条件竞争问题 #306
wanglong9创建于 4月10日关闭于 4月22日
4月10日 将 liu-wei 设为负责人
liu-wei
4月11日 评论:
4月11日 评论:
问题1:
issue 描述的"UpdateOutputDataTensor 和 DeleteOutputDataPtr 并发访问"在 ops-cv 中不成立。DeleteOutputDataPtr 从未被调用,不存在并发。而且按照算子逻辑,有调用的话也会按照穿行调用,不会存在并发。进程推出即释放。
问题2:
实际生产风险极低(GE 传入的始终是 NodeProto*),但从代码一致性和防御性编程角度,改为 dynamic_cast 是合理的改进。算子团队可以确认下。


4月13日 将 yanke-xu 设为负责人
4月20日 移除了负责人 liu-wei
4月20日 关联了pull request:Wsl_nn_reinterpret_cast修改
4月22日 关闭了 issue
4月22日 添加了label:resolved
Thanks for sending an issue! Please fill in the following template to help quickly solve your problem.
Describe the current behavior / 问题描述 (Mandatory / 必填)
1. g_allocated_ptr 操作无锁保护存在条件竞争问题
在common/src/common/allocator_utils.cpp中的g_allocated_ptr ,CpuKernelAllocatorUtils::UpdateOutputDataTensor 与CpuKernelAllocatorUtils::DeleteOutputDataPtr 函数对其并发访问,没有锁保护,可能存在条件问题。
2. 对<const NodeProto*>(op_src)的强转操作不一致
在整个仓中,大部分对<const NodeProto*>(op_src)的强转都使用dynamic_cast。但是存在以下几个函数,使用reinterpret_cast 可能强转失败,存在问题。
ParseParamsBatchMultiClassNMS
ParseParamsUpsample
OpRoiAlignUpdateInfo
ParseParamsRoiAlignV16
ParseParamsRoiAlignRotated
Environment / 环境信息 (Mandatory / 必填)
无
Steps to reproduce the issue / 重现步骤 (Mandatory / 必填)
无
Describe the expected behavior / 预期结果 (Mandatory / 必填)
加校验保护
Related log / screenshot / 日志 / 截图 (Mandatory / 必填)
无
Special notes for this issue/备注 (Optional / 选填)
无