More loitering process curiosities

W. Michael Petullo mike at flyn.org
Mon Nov 3 20:12:33 UTC 2003


>>> We've made some progress getting gconfd-2 to exit when a user logs out
>>> (see "gconfd-2 does not exit when a user log out, breaks unmounting
>>> home" thread).  Now I am interested in turning my attention to some
>>> other processes that seem to loiter around after one logs out of a GNOME
>>> 2.4.0 session.
>>>
>>> Pam_mount performs an lsof that claims the processes are still running
>>> when pam_close_session is called, but the processes are gone after the
>>> user is completely logged out (Unlike gconfd-2, which stayed running
>>> for two minutes).
>>>
>>> The following processes hang around (with $HOME as their CWD):
>>>
>>> bonobo-activation-server
>>> gnome-settings-daemon
>>> xscreensaver
>>> mapping-daemon

>> But I'm still curious about this process hierarchy.  Why do processes
>> like bonobo-activation-server and gnome-panel seem to execute with init
>> as their parent?
> 
> When doing a fork/exec, GLib programs usually use the g_spawn_ family of
> functions; these fork twice, creating an intermediate child process that
> immediately exits and is reaped by the parent. The purpose is to avoid
> zombies, as usually in a GUI context parent/child doesn't mean much. 
> (e.g. say Evolution launches your web browser there's no point really
> having the browser be a child of evolution)

Thanks to all who explained.  There is also a mail thread from 2000 on
gnome-devel-list titled "Process Tree."

I updated the gconfd-2-killing gnome-session patch I have submitted to
GNOME's bugzilla to use execvp/waitpid instead of gnome_execute_async.
Is there a more GNOME/glib-happy way to wait for a forked process?

I also send the following very simple patch to the gdm folks.  It fixes my
problem with X programs hanging around when pam_close_session is called,
but I'm not sure if it would break anything else.  Here it is:


diff -u --recursive gdm-2.4.4.5-vanilla/daemon/slave.c gdm-2.4.4.5/daemon/slave.c
--- gdm-2.4.4.5-vanilla/daemon/slave.c	2003-10-16 11:38:45.000000000 -0500
+++ gdm-2.4.4.5/daemon/slave.c	2003-11-03 11:19:31.000000000 -0600
@@ -864,6 +864,8 @@
 				gdm_slave_quick_exit (DISPLAY_REMANAGE);
 			}
 		}
+
+		gdm_verify_cleanup (d);
 	}
 	/* very very very evil, should never break, we can't return from
 	   here sanely */
@@ -4132,8 +4134,6 @@
     /* things are going to be killed, so ignore errors */
     XSetErrorHandler (ignore_xerror_handler);
 
-    gdm_verify_cleanup (d);
-
     in_session_stop --;
 
     if (need_to_quit_after_session_stop) {

-- 
Mike

:wq





More information about the devel mailing list