Skip to content

fix: add timeout for dde-shell services to prevent startup failure#219

Open
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:master
Open

fix: add timeout for dde-shell services to prevent startup failure#219
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743

@18202781743 18202781743 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Change the TimeoutStartSec from infinity to 10 seconds for both dde-
shell-plugin and dde-shell services. This prevents the deepin-service-
manager from getting stuck waiting indefinitely when these services fail
to start, allowing the system to properly handle startup failures and
improve overall system stability.

Log: Added startup timeout for dde-shell services

Influence:

  1. Test normal startup of DDE desktop services
  2. Verify services start within 10 seconds under normal conditions
  3. Test startup delay scenarios to ensure timeout works correctly
  4. Monitor deepin-service-manager startup behavior after timeout trigger
  5. Verify system logs show proper timeout events
  6. Test service restart behavior after timeout

fix: 为 dde-shell 服务添加超时机制以防止启动失败

将 dde-shell-plugin 和 dde-shell 服务的 TimeoutStartSec 从无限改为 10
秒。这可以防止 deepin-service-manager 在这些服务启动失败时无限期阻塞,使
系统能够正确处理启动失败,提升整体系统稳定性。

Log: 为 dde-shell 服务添加启动超时

Influence:

  1. 测试 DDE 桌面服务的正常启动
  2. 验证服务在正常条件下能在 10 秒内启动完成
  3. 测试启动延迟场景以确保超时机制正确工作
  4. 监控超时触发后 deepin-service-manager 的启动行为
  5. 验证系统日志显示正确的超时事件
  6. 测试超时后的服务重启行为

Summary by Sourcery

Introduce a startup timeout for dde-shell services to avoid indefinite blocking when these services fail to start.

Bug Fixes:

  • Prevent deepin-service-manager from hanging indefinitely by applying a 10-second TimeoutStartSec to dde-shell-plugin and dde-shell systemd units.

Deployment:

  • Adjust systemd unit configuration for dde-shell services to enforce a bounded startup timeout.

Change the TimeoutStartSec from infinity to 10 seconds for both dde-
shell-plugin and dde-shell services. This prevents the deepin-service-
manager from getting stuck waiting indefinitely when these services fail
to start, allowing the system to properly handle startup failures and
improve overall system stability.

Log: Added startup timeout for dde-shell services

Influence:
1. Test normal startup of DDE desktop services
2. Verify services start within 10 seconds under normal conditions
3. Test startup delay scenarios to ensure timeout works correctly
4. Monitor deepin-service-manager startup behavior after timeout trigger
5. Verify system logs show proper timeout events
6. Test service restart behavior after timeout

fix: 为 dde-shell 服务添加超时机制以防止启动失败

将 dde-shell-plugin 和 dde-shell 服务的 TimeoutStartSec 从无限改为 10
秒。这可以防止 deepin-service-manager 在这些服务启动失败时无限期阻塞,使
系统能够正确处理启动失败,提升整体系统稳定性。

Log: 为 dde-shell 服务添加启动超时

Influence:
1. 测试 DDE 桌面服务的正常启动
2. 验证服务在正常条件下能在 10 秒内启动完成
3. 测试启动延迟场景以确保超时机制正确工作
4. 监控超时触发后 deepin-service-manager 的启动行为
5. 验证系统日志显示正确的超时事件
6. 测试超时后的服务重启行为
@sourcery-ai

sourcery-ai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR introduces a 10-second startup timeout for the dde-shell-plugin and dde-shell systemd services to prevent deepin-service-manager from blocking indefinitely when these services fail to start.

File-Level Changes

Change Details Files
Add a 10-second TimeoutStartSec to dde-shell-related systemd units instead of an infinite timeout.
  • Update the dde-shell-plugin service unit to set TimeoutStartSec=10s for startup.
  • Update the dde-shell service unit to set TimeoutStartSec=10s for startup.
systemd/dde-session-core.target.wants/[email protected]
systemd/dde-session-core.target.wants/[email protected]

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, yixinshark

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:100分

■ 【总体评价】

代码修复了systemd服务因无限等待D-Bus注册导致的会话卡死问题,显著提升了系统启动健壮性
逻辑正确且符合systemd配置规范,彻底消除了会话初始化阻塞风险,无需扣分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

修改将TimeoutStartSec=infinity调整为TimeoutStartSec=10s,语法完全符合systemd服务配置规范。在[email protected][email protected]中,针对Type=dbus类型的服务,设定具体的超时时间能让systemd正确处理启动失败场景。
潜在问题:无
建议:保持当前修改

  • 2.代码质量(良好)✓

配置项修改精准定位了问题根源,未引入冗余配置。10秒的超时时间对于D-Bus服务注册是合理的阈值,既给予了足够的服务初始化时间,又避免了过长时间的无效等待。
潜在问题:无
建议:可考虑在配置文件中添加注释说明为何选择10秒超时,以便后续维护人员理解

  • 3.代码性能(无性能问题)✓

原配置infinity会导致系统资源被无限期占用在等待状态,修改为10s后,若服务启动失败,systemd将在10秒后释放等待资源并依据Restart=always策略重启,极大提升了系统资源流转效率和会话初始化性能。
潜在问题:无
建议:保持当前修改

  • 4.代码安全(存在0个安全漏洞)✓
    漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个
    本次修改为systemd配置超时参数调整,不涉及任何外部输入处理、内存操作或权限变更,不存在命令注入、缓冲区溢出等安全风险。修改前的无限等待可被视为可用性缺陷,但本次代码变更本身未引入任何安全漏洞。
  • 建议:无需针对安全进行额外修复

■ 【改进建议代码示例】

--- a/systemd/dde-session-core.target.wants/[email protected]
+++ b/systemd/dde-session-core.target.wants/[email protected]
@@ -18,7 +18,8 @@ After=dbus.socket
 Type=dbus
 BusName=com.deepin.dde.desktop
 ExecStart=/usr/bin/dde-shell -p %I
-TimeoutStartSec=infinity
+# 设置10秒超时,避免服务异常时systemd无限等待导致会话卡死
+TimeoutStartSec=10s
 Slice=session.slice
 Restart=always
 RestartSec=1s
diff --git a/systemd/dde-session-core.target.wants/[email protected] b/systemd/dde-session-core.target.wants/[email protected]
index 82e64c4..2309b09 100644
--- a/systemd/dde-session-core.target.wants/[email protected]
+++ b/systemd/dde-session-core.target.wants/[email protected]
@@ -21,7 +21,8 @@ Wants=org.desktopspec.ApplicationManager1.service
 Type=dbus
 BusName=org.deepin.dde.Dock1
 ExecStart=/usr/bin/dde-shell -C %I --serviceName=org.deepin.dde.shell -d org.deepin.ds.desktop
-TimeoutStartSec=infinity
+# 设置10秒超时,避免服务异常时systemd无限等待导致会话卡死
+TimeoutStartSec=10s
 Slice=session.slice
 Restart=always
 RestartSec=1s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants