Re: [gdm-list] Leftover processes.




Hedblom:

I run a pretty large terminal server on Linux (Edubuntu/Breezy Badger)
with 60 concurrent sessions and about 400 total users. With X11 sessions
that die for various reasons leaves processes hanging. Cleaning theese
up is pretty cumbersome and potentially dangerous on a 24/7 system. Is
gdm supposed to clean this out or are the applications in gnome that
hangs around just badly written and not listening to term signals?

You might consider trying to fix the problems that cause X11 session to
die. Disabling the ability to kill a session by hitting Ctrl-Alt-Backspace might help (you do this in your Xorg config file).

Turning on AlwaysRestartServer in gdm.conf may reduce problems that
would cause the Xserver to die if you are seeing problems like Xservers
crashing after running for a long time.  GDM re-uses the Xserver for a
display for each user that logs in.  Memory leaks or whatnot can cause
the process to get sick and die after a while.  AlwaysRestartServer
helps to avoid this by ensuring the Xserver is restarted for each user
who logs in.  This is a tad bit slower for login time, but more stable
for systems that want to run 24/7.

If you can identify the orphan processes, killing them in the
/etc/gdm/PostSession script might also be an option.  This is a bit
of a hack, but might make things work better.

Im very interested in solving this but i dont really know where to
start. Ive just recently begun programming so i dont understand the gdm
code yet.

This is a hard problem, and GDM does make an effort to clean up running
process, but your mileage may vary.  The code for doing this is
in gdm_slave_session_stop and that would be a good place to look.

I'd build the code with debug turned on.  Note that when you start
a session with GDM that the processes look like this:

gdm-binary -> gdm-binary -> Xorg
                        \-> gnome-session

So the main daemon forks and has a slave gdm-binary for the display
which starts Xorg and gnome-session.  The gdm_slave_session_stop
function is run by the child gdm-binary.  If you attach a debugger
to the child gdm-binary process and kill the session you should be
able to follow the logic and watch it kill the running processes
for that display, etc.

Depending on how you kill the session may affect how the logic
runs.  So if you kill the session by hitting Ctrl-Alt-Backspace
it will be different than selecting logout in the panel, or
sending a kill signal to one of the processes (sending a kill
to Xorg, gnome-session, or the child gdm-binary) would all kill
the session but would behave differently.

Tracing through the code in the different situations and seeing
how it works for each, and noticing how it acts differently
in the failure condition would probably highlight the issue.

One bit of nastyness is the XIOError handler stuff.  GDM tries
to manage XIOError but the code is a bit complicated and it
doesn't surprise me it might not work in some situations.  Read
up on the X11 XError documentation to understand this.

Brian




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]