Repository navigation
Cleanup sessions on exit - #1249
Conversation
On exit we currently don't do any cleanup. This leaves stray processes running. Some aren't even the responsibility of the session, such as anything spawned in the Xsessions.d directory. In the event of a hard reset (systemctl --restart sddm) we currently don't even send a SIGTERM to the session leader. By registering as a subreaper we can have the kernel automatically clean up anything when sddm-helper is quit gracefully or unexpectedly.
|
I assume that nobody is using Linux < 3.4 at this point. |
Vogtinator
left a comment
There was a problem hiding this comment.
Does sddm currently handle SIGCHLD? If not, this would cause zombie processes to appear.
|
|
||
| QTimer::singleShot(0, this, SLOT(setUp())); | ||
| #if defined(Q_OS_LINUX) | ||
| prctl(PR_SET_CHILD_SUBREAPER); |
There was a problem hiding this comment.
According to the manpage:
PR_SET_CHILD_SUBREAPER (since Linux 3.4)
If arg2 is nonzero, set the "child subreaper" attribute of the calling process; if arg2 is zero, unset the attribute.
So this is an invalid call as the argument is missing.
It does not explicitly. My understanding from the docs is that was only if we wanted to block until the children finished exiting. It might have temporary zombies, but they do all get a TERM signal, and in my testing disappear.
You are right :/ |
What I'm mostly wondering about is how this behaves together with the weird Unfortunately this area is very badly documented... |
They do. logging in (as the greeter is a session too) and everything behaved as you would expect |
|
Currently, anything orphaned gets parented straight to init, so init can decide what to do, either keep it or explicitly kill it. For systemd, this is explicitly configured as So currently I don't understand this PR for two reasons:
Am I missing something? |
On exit we currently don't do any cleanup. This leaves stray processes
running. Some aren't even the responsibility of the session, such as
anything spawned in the Xsessions.d directory.
In the event of a hard reset (systemctl --restart sddm) we currently
don't even send a SIGTERM to the session leader.
By registering as a subreaper we can have the kernel automatically clean
up anything when sddm-helper is quit gracefully or unexpectedly.