[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:43 CEST 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.
commit 52314435eb78a79ea0622450a691a1f672f9d39f
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).
---
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 882863a..cf332b4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,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 f531e7f..4debd42 100644
--- a/debian/control
+++ b/debian/control
@@ -28,6 +28,7 @@ Depends:
libdbd-pg-perl,
libdbd-sqlite3-perl,
libfile-basedir-perl,
+ libfile-remove-perl,
libcapture-tiny-perl,
adduser,
xauth,
diff --git a/x2goserver.spec b/x2goserver.spec
index e142d0c..14c5725 100644
--- a/x2goserver.spec
+++ b/x2goserver.spec
@@ -48,6 +48,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 56dcbbd..62f4be7 100755
--- a/x2goserver/sbin/x2gocleansessions
+++ b/x2goserver/sbin/x2gocleansessions
@@ -23,6 +23,7 @@
use strict;
use Sys::Hostname;
use Sys::Syslog qw( :standard :macros );
+use File::Remove 'remove';
use POSIX;
@@ -191,6 +192,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");
@@ -200,6 +206,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