Repository navigation
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
| if (config) { | ||
| config->release(); | ||
| try { | ||
| auto reply = config->release(); |
There was a problem hiding this comment.
这里能否不wait,保持异步处理,另外应该不需要用try cache吧,
There was a problem hiding this comment.
try cache是必须的,这里有个异常导致崩溃
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe destructor now synchronously waits for the asynchronous D-Bus release operation, reports reply failures, and catches exceptions to prevent shutdown-time SIGABRT caused by errors crossing the QThread boundary. Sequence diagram for safe D-Bus release during destructionsequenceDiagram
participant DBusBackend
participant DConfig
participant SystemBus
DBusBackend->>DConfig: release()
DConfig-->>DBusBackend: pending reply
DBusBackend->>DConfig: waitForFinished()
DConfig->>SystemBus: complete release request
SystemBus-->>DConfig: reply or error
DConfig-->>DBusBackend: finished reply
alt reply.isError()
DBusBackend->>DBusBackend: qCWarning(reply.error().message())
end
alt release throws std::exception
DBusBackend->>DBusBackend: qCWarning(e.what())
end
DBusBackend-->>DBusBackend: destructor completes without escaping exception
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/dconfig.cpp" line_range="508" />
<code_context>
- config->release();
+ try {
+ auto reply = config->release();
+ reply.waitForFinished();
+ if (reply.isError()) {
+ qCWarning(cfLog) << "DConfig release failed:"
</code_context>
<issue_to_address>
**Shutdown stalls on release**
When the release service remains connected but does not reply promptly, `reply.waitForFinished()` blocks the destructor while the D-Bus release call awaits a reply, stalling the owning thread and delaying shutdown; delays can multiply when multiple configs are destroyed.
Avoid waiting synchronously for the release reply in the destructor, or bound the wait with a timeout.
</issue_to_address>DBusBackend::~DBusBackend() always called config->release() during destruction even if the underlying connection was already closed. On system shutdown the global system-bus connection is being torn down concurrently, so the async send path blocks on QDBusConnectionPrivate's read lock and the DBus manager thread can crash with an uncaught exception (SIGABRT). release() just notifies dde-dconfig-daemon to drop its reference; when the connection is already closed the message cannot be delivered anyway and the daemon cleans up references on disconnect, so skipping the call is safe. Guard the call with connection().isConnected() and keep the existing exception guard. fix: DConfig 析构时连接已关闭则跳过 release DBusBackend::~DBusBackend() 析构时无条件调用 config->release(),即使底层 连接已关闭。系统关机时全局 system-bus 连接正被并发销毁,异步发送路径会 阻塞在 QDBusConnectionPrivate 的读锁上,DBus 管理线程可能因未捕获异常 崩溃(SIGABRT)。 release() 只是通知 dde-dconfig-daemon 减引用;连接已关闭时消息本就无法 送达,daemon 侧会在连接断开时自动清理引用,跳过该调用是安全的。用 connection().isConnected() 保护该调用,并保留原有异常兜底。 Log: 修复 deepin-service-manager 关机/重启时偶发 SIGABRT 崩溃 PMS: BUG-381521 Influence: 关机/重启时 DConfig 注销不再触发 DBus 读锁阻塞与崩溃;回归验证可观察 deepin-service-plugin@org.deepin.dde.WallpaperCache 关机时正常退出。
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['无需修改,代码逻辑正确。'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['无需修改,注释和代码结构良好。'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['无需修改,性能改善合理。'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['无需修改,安全合规。'] 💡 改进建议代码示例// 当前代码已是最佳实践,无需修改: // DBusBackend::~DBusBackend() // { // if (config) { // try { // if (config->connection().isConnected()) { // config->release(); // } // } catch (const std::exception &e) { // qCWarning(cfLog) << "DConfig release exception:" << e.what(); // } // } // }本报告由 AI 代码审查工具自动生成 |
|
TAG Bot New tag: 6.7.53 |
|
TAG Bot New tag: 6.7.54 |
|
TAG Bot New tag: 6.7.55 |
DBusBackend::~DBusBackend() always called config->release() during
destruction even if the underlying connection was already closed. On
system shutdown the global system-bus connection is being torn down
concurrently, so the async send path blocks on QDBusConnectionPrivate's
read lock and the DBus manager thread can crash with an uncaught
exception (SIGABRT).
release() just notifies dde-dconfig-daemon to drop its reference; when
the connection is already closed the message cannot be delivered anyway
and the daemon cleans up references on disconnect, so skipping the call
is safe. Guard the call with connection().isConnected() and keep the
existing exception guard.
fix: DConfig 析构时连接已关闭则跳过 release
DBusBackend::~DBusBackend() 析构时无条件调用 config->release(),即使底层
连接已关闭。系统关机时全局 system-bus 连接正被并发销毁,异步发送路径会
阻塞在 QDBusConnectionPrivate 的读锁上,DBus 管理线程可能因未捕获异常
崩溃(SIGABRT)。
release() 只是通知 dde-dconfig-daemon 减引用;连接已关闭时消息本就无法
送达,daemon 侧会在连接断开时自动清理引用,跳过该调用是安全的。用
connection().isConnected() 保护该调用,并保留原有异常兜底。
Log: 修复 deepin-service-manager 关机/重启时偶发 SIGABRT 崩溃
PMS: BUG-381521
Influence: 关机/重启时 DConfig 注销不再触发 DBus 读锁阻塞与崩溃;回归验证可观察 deepin-service-plugin@org.deepin.dde.WallpaperCache 关机时正常退出。
Summary by Sourcery
Prevent D-Bus backend destruction from propagating release failures during system shutdown.
Bug Fixes:
Enhancements: