已合并
fix application agent stub crash at so unload via synchronous unregister IPC and lifecycle owner #31855
LyBbq创建于 7月31日
fix application agent stub crash at so unload via synchronous unregister IPC and lifecycle owner #31855
已合并
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 LyBbq 的贡献)7月31日 添加了label:waiting_on_author
openharmony_ci
7月31日 评论:
7月31日 评论:
感谢提交 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.


7月31日 添加了label:dco检查成功
rosen/modules/render_service_client/core/transaction/rs_application_agent_impl.cpp
已过期
@@ -103,0 +125,4 @@
125+ return instance;
126+}
127+
128+RSApplicationAgentLifecycleOwner::RSApplicationAgentLifecycleOwner() = default;
这个为啥要独立写?


此处折叠了101条消息 查看更多
8月10日 删除了label:waiting_for_review
8月10日 添加了label:merged
Description:
问题背景:
RSApplicationAgentImpl是客户端侧 binder stub,注册到 render service 后服务端持有其 proxy 强引用。旧清理链路存在两个问题:RSRenderServiceConnectHub的 OnDiedCallbacks →RSApplicationAgentImpl::Destroy()),服务端侧依赖RSClientToRenderConnection::CleanAll在连接删除时顺带注销。若客户端 so 被 dlclose 卸载时服务端仍持有 agent proxy,binder 内核延迟下发的DecStrongRef会析构一个 vtable 已 unmap 的 stub,导致应用进程 SEGV;isDestreuctionProcess_为非原子 bool,Instance()每次调用重复注册死亡回调,Destroy()与注册流程存在竞态。修复方案:
UNREGISTER_APPLICATION_AGENT(0x000010):proxy 以TF_SYNC发送、不携带参数——服务端按 calling pid 反查 agent 并注销、摘除 death recipient。同步等待确保客户端析构 stub 前服务端已释放 proxy 强引用;同步补齐 access verifier(限频 15 次)、safuzz 名称表、stub descriptor 白名单Destroy()重构为幂等的Release()——持锁清空全局单例,若曾注册则调用静态UnregisterFromAllConnections(),经新增GetAllClientToRenderConnections()(锁下快照)遍历所有渲染进程连接逐一发注销 IPC,映射为空时回退默认连接;整体删除 SetOnDiedCallback / RemoveOnDiedCallback / ExecuteAndClearDiedCallbacks 死亡回调机制及对应单测RSApplicationAgentLifecycleOwner函数局部静态——首次使用(RSUIDirector::Init)时构造并注册 agent,静态析构时驱动一次Release()。利用 librender_service_client 先于 librender_service_base 卸载的依赖顺序,保证发出同步注销 IPC 时连接仍可用、stub 代码段仍处于映射状态RegisterRSApplicationAgent改为mutex_+ 原子isRegistered_标志,替代原函数内静态 atomic,与Release()互斥;服务端CleanAll不再顺带注销 app agent(职责移交显式 IPC)Issue number:https://gitcode.com/openharmony/graphic_graphic_2d/issues/25408
Test & Result:
CodeCheck:
L0新增用例自检结果