Repository navigation
fix: send SIGTERM to process that does not respond to TerminateSession - #70
Conversation
Some child processes may linger (e.g. gnome-keyring-daemon), kill them to avoid the whole session stuck in closing state. Send SIGKILL directly may make systemd-logind be left in a bad state and cannot handle future login, so send SIGTERM instead. TODO: Find out why
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds a follow-up SIGTERM-based KillSession call after TerminateSession to ensure lingering child processes are cleaned up without destabilizing logind, and simplifies the D-Bus error check for GetSessionByPID. Sequence diagram for session termination with follow-up SIGTERM KillSessionsequenceDiagram
participant Display
participant QTimer
participant ManagerInterface as OrgFreedesktopLogin1ManagerInterface
participant Logind as systemd_logind
Display->>ManagerInterface: TerminateSession(id)
ManagerInterface->>Logind: TerminateSession(id)
Logind-->>ManagerInterface: Session_termination_started
ManagerInterface-->>Display: D-Bus_reply
Display->>QTimer: singleShot(2000ms, callback)
Note over QTimer,Display: 2 second delay
QTimer-->>Display: invoke_callback(id)
Display->>ManagerInterface: KillSession(id, all, 15)
ManagerInterface->>Logind: KillSession(id, all, SIGTERM)
Logind-->>ManagerInterface: Remaining_child_processes_killed
ManagerInterface-->>Display: D-Bus_reply
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Hi @calsys456. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The hard-coded values for the 2-second delay and signal 15 in the KillSession call would be clearer and easier to adjust if they were defined as named constants (e.g., kSessionTerminateGracePeriodMs, kSigTerm).
- Since this KillSession fallback is addressing a subtle stuck-session issue, consider logging when the timer triggers and when KillSession fails, so it’s easier to diagnose lingering processes or regressions in production.
- The TODO about understanding why SIGKILL leaves logind in a bad state should ideally reference a tracking issue or be expanded with current hypotheses, so future maintainers know how to follow up.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The hard-coded values for the 2-second delay and signal 15 in the KillSession call would be clearer and easier to adjust if they were defined as named constants (e.g., kSessionTerminateGracePeriodMs, kSigTerm).
- Since this KillSession fallback is addressing a subtle stuck-session issue, consider logging when the timer triggers and when KillSession fails, so it’s easier to diagnose lingering processes or regressions in production.
- The TODO about understanding why SIGKILL leaves logind in a bad state should ideally reference a tracking issue or be expanded with current hypotheses, so future maintainers know how to follow up.
## Individual Comments
### Comment 1
<location> `src/daemon/Display.cpp:381` </location>
<code_context>
+ // instead.
+
+ // TODO: Find out why
+ manager.KillSession(QString::number(id), "all", 15);
+ });
}
</code_context>
<issue_to_address>
**nitpick:** Use a named constant or symbolic value instead of the magic number `15` for the signal.
For example, you could pass `SIGTERM` directly or define a local `constexpr int kSigTerm = 15;`. This keeps the call self-documenting and consistent with the surrounding SIGTERM/SIGKILL comment.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: calsys456, zccrs 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 |
Some child processes may linger (e.g. gnome-keyring-daemon), kill them to avoid the whole session stuck in closing state. Send SIGKILL directly may make systemd-logind be left in a bad state and cannot handle future login, so send SIGTERM instead.
TODO: Find out why
Summary by Sourcery
Ensure lingering login sessions are cleanly terminated by sending SIGTERM to processes that do not exit after TerminateSession, and improve session lookup error handling in authentication.
Bug Fixes: