[gdm] daemon: don't every SIGKILL children



commit 4cb2b3fa34d43e72325bba210f86a0732856090a
Author: Ray Strode <rstrode redhat com>
Date:   Thu Dec 22 12:28:07 2011 -0500

    daemon: don't every SIGKILL children
    
    There's no situation where it's the right thing to do.
    The children of the daemon are responsible for themselves.
    If they don't go away when asked we shouldn't second guess
    them, we just need to ignore them.
    
    This means we may end up with zombie children if those children
    have bugs, but it's better than prematurely killing them if they're
    slow.

 common/gdm-common.c             |   17 ++++++++---------
 common/gdm-common.h             |    4 ++--
 daemon/gdm-session-worker-job.c |    2 +-
 3 files changed, 11 insertions(+), 12 deletions(-)
---
diff --git a/common/gdm-common.c b/common/gdm-common.c
index 865341a..e035dfd 100644
--- a/common/gdm-common.c
+++ b/common/gdm-common.c
@@ -84,8 +84,8 @@ gdm_get_pwent_for_name (const char     *name,
 }
 
 int
-gdm_wait_on_and_kill_pid (int pid,
-                          int timeout)
+gdm_wait_on_and_disown_pid (int pid,
+                            int timeout)
 {
         int status;
         int ret;
@@ -121,17 +121,16 @@ gdm_wait_on_and_kill_pid (int pid,
 
                         path = g_strdup_printf ("/proc/%ld/cmdline", (long) pid);
                         if (g_file_get_contents (path, &command, NULL, NULL)) {;
-                                g_debug ("GdmCommon: process (pid:%d, command '%s') isn't dying, now killing it.",
-                                         (int) pid, command);
+                                g_warning ("GdmCommon: process (pid:%d, command '%s') isn't dying after %d seconds, now ignoring it.",
+                                         (int) pid, command, timeout);
                                 g_free (command);
                         } else {
-                                g_debug ("GdmCommon: process (pid:%d) isn't dying, now killing it.",
-                                         (int) pid);
+                                g_warning ("GdmCommon: process (pid:%d) isn't dying after %d seconds, now ignoring it.",
+                                         (int) pid, timeout);
                         }
                         g_free (path);
 
-                        kill (pid, SIGKILL);
-                        flags = 0;
+                        return 0;
                 }
                 goto wait_again;
         }
@@ -151,7 +150,7 @@ gdm_wait_on_and_kill_pid (int pid,
 int
 gdm_wait_on_pid (int pid)
 {
-    return gdm_wait_on_and_kill_pid (pid, 0);
+    return gdm_wait_on_and_disown_pid (pid, 0);
 }
 
 int
diff --git a/common/gdm-common.h b/common/gdm-common.h
index 41ddf1c..899be50 100644
--- a/common/gdm-common.h
+++ b/common/gdm-common.h
@@ -33,8 +33,8 @@ G_BEGIN_DECLS
 gboolean       gdm_is_version_unstable            (void);
 
 int            gdm_wait_on_pid           (int pid);
-int            gdm_wait_on_and_kill_pid  (int pid,
-                                          int timeout);
+int            gdm_wait_on_and_disown_pid (int pid,
+                                           int timeout);
 int            gdm_signal_pid            (int pid,
                                           int signal);
 gboolean       gdm_get_pwent_for_name    (const char     *name,
diff --git a/daemon/gdm-session-worker-job.c b/daemon/gdm-session-worker-job.c
index ac96cf1..cb2901a 100644
--- a/daemon/gdm-session-worker-job.c
+++ b/daemon/gdm-session-worker-job.c
@@ -289,7 +289,7 @@ handle_session_worker_job_death (GdmSessionWorkerJob *session_worker_job)
         int exit_status;
 
         g_debug ("GdmSessionWorkerJob: Waiting on process %d", session_worker_job->priv->pid);
-        exit_status = gdm_wait_on_and_kill_pid (session_worker_job->priv->pid, 3);
+        exit_status = gdm_wait_on_and_disown_pid (session_worker_job->priv->pid, 5);
 
         if (WIFEXITED (exit_status) && (WEXITSTATUS (exit_status) != 0)) {
                 g_debug ("GdmSessionWorkerJob: Wait on child process failed");



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