[X2Go-Commits] [x2goserver] 01/02: Handle stale X11 socket files in cases where x2goagent has mysteriously disappeared (e.g. kill -9). (Fixes: #626).

git-admin at x2go.org git-admin at x2go.org
Fri Oct 3 12:38:42 CEST 2014


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit e7d2289b4caa2cceaade0a6754861894a8385f11
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Fri Oct 3 12:33:24 2014 +0200

    Handle stale X11 socket files in cases where x2goagent has mysteriously disappeared (e.g. kill -9). (Fixes: #626).
    
    Conflicts (resolved by Mike Gabriel):
    	debian/control
---
 debian/changelog                  |    2 ++
 debian/control                    |    1 +
 x2goserver.spec                   |    1 +
 x2goserver/sbin/x2gocleansessions |   12 ++++++++++++
 4 files changed, 16 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 23e61a5..23c26bd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -129,6 +129,8 @@ x2goserver (4.0.1.17-0x2go1) UNRELEASED; urgency=medium
   * New upstream release (4.0.1.17):
     - Fix breakage of X2Go Server when upgrading from 4.0.1.15 while
       sessions are still in running / suspended state. (Fixes: #623).
+    - Handle stale X11 socket files in cases where x2goagent has
+      mysteriously disappeared (e.g. kill -9). (Fixes: #626).
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Thu, 02 Oct 2014 12:18:58 +0200
 
diff --git a/debian/control b/debian/control
index a713dd6..6735b05 100644
--- a/debian/control
+++ b/debian/control
@@ -20,6 +20,7 @@ Depends:
  x2goserver-common (>= ${source:Version}), x2goserver-common (<< ${source:Version}.1~),
  ${misc:Depends},
  libfile-basedir-perl,
+ libfile-remove-perl,
  libtry-tiny-perl,
  libswitch-perl,
  libx2go-server-perl (>= ${source:Version}), libx2go-server-perl (<< ${source:Version}.1~),
diff --git a/x2goserver.spec b/x2goserver.spec
index 121f0ed..96c6a1f 100644
--- a/x2goserver.spec
+++ b/x2goserver.spec
@@ -49,6 +49,7 @@ Requires:       sudo
 Requires:       x2goagent >= 3.5.0.25
 Requires:       xorg-x11-fonts-misc
 Requires:       xorg-x11-xauth
+Requires:       perl(Files::Remove)
 Requires(pre):  shadow-utils
 Requires(post): grep
 Requires(post): perl(DBD::SQLite)
diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions
index 7567b2b..8bc64dc 100755
--- a/x2goserver/sbin/x2gocleansessions
+++ b/x2goserver/sbin/x2gocleansessions
@@ -26,6 +26,7 @@ $ENV{'PATH'} = "/bin:/sbin:/usr/bin:/usr/sbin";
 
 use Sys::Hostname;
 use Sys::Syslog qw( :standard :macros );
+use File::Remove 'remove';
 use POSIX;
 
 use X2Go::Config qw( get_config );
@@ -163,6 +164,11 @@ elsif ($pid == 0 )
 					# send SIGKILL to dangling X-server processes
 					syslog('warning', "@sinfo[1]: found stale X-server process (@sinfo[0]), sending SIGKILL");
 					system("kill", "-9", "@sinfo[0]");
+					my $display = @sinfo[3];
+					if (-S "/tmp/.X11-unix/X$display") {
+						# remove the NX-X11 socket file (as the agent will not have managed after a kill -9)
+						remove("/tmp/.X11-unix/X$display");
+					}
 					delete $remembered_sessions_since{@sinfo[1]};
 				}
 				syslog('debug', "@sinfo[1]: unmounting all shares");
@@ -172,6 +178,12 @@ elsif ($pid == 0 )
 			elsif (! check_pid (@sinfo[0], at sinfo[1], at sinfo[12]))
 			{
 				system("su", "@sinfo[11]", "-c", "$x2go_lib_path/x2gochangestatus 'F' @sinfo[1]");
+				my $display = @sinfo[3];
+				if (-S "/tmp/.X11-unix/X$display") {
+					# remove the NX-X11 socket file (we don't know how the agent disappeared,
+					# someone might have shot it with kill -9)
+					remove("/tmp/.X11-unix/X$display");
+				}
 				syslog('debug', "@sinfo[1], pid @sinfo[0] does not exist, changing status from @sinfo[4] to F");
 				syslog('debug', "@sinfo[1]: unmounting all shares");
 				system("su", "@sinfo[11]", "-c", "export HOSTNAME && x2goumount-session @sinfo[1]");

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list