已合并
fix ashmem fd container residue in unmarshal thread and enhance marshalling failure logs #31901
LyBbq创建于 8月3日
fix ashmem fd container residue in unmarshal thread and enhance marshalling failure logs #31901
已合并
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 LyBbq 的贡献)8月3日 添加了label:waiting_on_author
openharmony_ci
8月3日 评论:
8月3日 评论:
感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接。
Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.


8月3日 添加了label:dco检查成功
此处折叠了72条消息 查看更多
20 天前 删除了label:waiting_for_review
20 天前 添加了label:merged
Description:
问题背景:
unmarshal 并行开启后,
RSUnmarshalThread的 FFRT worker 线程会被多个 parcel 任务复用,而AshmemFdContainer是 thread_local 单例(offset→fd 映射表),此前仅依赖任务尾部的~AshmemFdWorker()清理。一旦某次任务提前返回未走清理路径,残留的旧 offset→fd 条目会被该线程上的下一个 parcel 命中:ReadSafeFd按 offset 查到属于上一个 parcel 的 fd(可能已 close),导致 ashmem 数据读取错乱、CopyFromAshmem尺寸校验失败、unmarshalling 失败甚至 unmarshal 线程崩溃。修复方案:
SetIsUnmarshalThread(true)之后、PushFdsToContainer()之前)主动调用AshmemFdContainer::Instance().Clear(),将 fd 表严格限定在本任务生命周期内,消除线程复用带来的脏数据;为此将Clear()从 private 提升为 public(rs_unmarshal_thread.cpp、rs_ashmem_helper.h)CreateAshmemParcel对 header 写入(interfaceToken / ashmem 标志 / dataSize / fd / offsetSize)逐项检查返回值,任一失败立即打日志并返回 nullptr,避免发出格式残缺的 ashmem parcel 导致对端解析失败(rs_ashmem_helper.cpp)return false的分支新增ROSEN_LOGE,覆盖 DrawCmdList(recordCmd / 扩展对象 / 各类 size 超限)、RSLinearGradientBlurPara、粒子参数、Surface 读写、WriteToParcel等;另补充CommitTransaction中renderPipelineAgent_为空的丢包日志、AshmemAllocator::WriteToAshmem/CopyFromAshmem参数非法日志、ParseFromAshmemParceltoken 不匹配日志,便于定位 unmarshalling 失败的具体环节Issue number:https://gitcode.com/openharmony/graphic_graphic_2d/issues/25442
Test & Result:
CodeCheck:
L0新增用例自检结果