Hi all,

I ran into this bug too, while trying to deploy Xrdp as a terminal
server solution for a customer of mine.  It seems that there is also now
an upstream bug report for this and that it is thus still present in the
later releases:  https://sourceforge.net/p/xrdp/bugs/54/.

I have attached a patch that is a modified version of the
aforementioned 09sesman_sig_handling.dpatch.  This patch not only lets
the SIGCHLD handler reap all zombie child processes, but also reconnects
this handler after the fork of xrdp-sessvc and the entire session has
happened.  This is not a solution I'd recommend using in the packaging
;), as it is quick & dirty, but it does indicate where the problem
lies...  the SIGCHLD signal handler gets disconnected somewhere around
the fork.

Kind regards,
Paul

-- 
Using the Power of Debian GNU/Linux  | E-mail: pau...@debian.org
Jabber/GTalk: p...@luon.net          | GnuPG key ID: 0x50064181
Description: When a user logged out, he/she cannot login anymore
 This is due to sesman leaving a defunct session parent, while it thinks
 the session is still running and thus fails to reconnect.

 This patch has been modified to also ensure that the SIGCHLD signal
 handler is reconnect after forking xrdp-sessvc and the entire session.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=469215
Bug-Upstream: https://sourceforge.net/p/xrdp/bugs/54/
Author: Vincent Bernat <ber...@luffy.cx>, Paul van Tilburg <p...@mozcode.nl>

--- a/sesman/sig.c
+++ b/sesman/sig.c
@@ -121,13 +121,14 @@
 
   if (g_getpid() != g_pid)
   {
+    log_message(&(g_cfg->log), LOG_LEVEL_WARNING, "g_getpid() [%d] differs from g_pid [%d]", g_getpid(), g_pid);
     return;
   }
-  pid = g_waitchild();
-  if (pid > 0)
-  {
+  while ((pid = g_waitchild()) > 0) {
+    LOG_DBG("g_waitchild() [%d] Child %d is dead", g_getpid(), pid);
     session_kill(pid);
   }
+  LOG_DBG("g_waitchild() [%d] No more children", g_getpid());
 }
 
 /******************************************************************************/
--- a/sesman/session.c
+++ b/sesman/session.c
@@ -562,6 +562,7 @@
   }
   else /* parent sesman process */
   {
+    g_signal_child_stop(sig_sesman_session_end); /* SIGCHLD */
     temp->item->pid = pid;
     temp->item->display = display;
     temp->item->width = width;

Reply via email to