Remove stale X11 lock files in cases where x2goagent mysteriously disappeared (e.g., due to kill -9 or a crash). This fixes bug #630 (and #626, which hasn't really been fixed yet). Tested against the original scenario from bug #626. --- x2goserver/sbin/x2gocleansessions | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index eb1bd3f..3b3775b 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -171,6 +171,11 @@ elsif ($pid == 0 ) syslog('warning', "@sinfo[1], pid @sinfo[0] cleaning up stale X11 socket file: /tmp/.X11-unix/X$display"); unlink("/tmp/.X11-unix/X$display"); } + if (-e "/tmp/.X$display-lock") { + # remove the NX-X11 lock file (as the agent will not have managed after a kill -9) + syslog('warning', "@sinfo[1], pid @sinfo[0] cleaning up stale X11 lock file: /tmp/.X$display-lock"); + unlink("/tmp/.X$display-lock"); + } syslog('debug', "@sinfo[1]: unmounting all shares"); system( "su", "@sinfo[11]", "-c", "export HOSTNAME && x2goumount-session @sinfo[1]"); } @@ -184,6 +189,12 @@ elsif ($pid == 0 ) syslog('warning', "@sinfo[1], pid @sinfo[0] cleaning up stale X11 socket file: /tmp/.X11-unix/X$display"); unlink("/tmp/.X11-unix/X$display"); } + if (-e "/tmp/.X$display-lock") { + # remove the NX-X11 lock file (we don't know how the agent disappeared, + # someone might have shot it with kill -9) + syslog('warning', "@sinfo[1], pid @sinfo[0] cleaning up stale X11 lock file: /tmp/.X$display-lock"); + unlink("/tmp/.X$display-lock"); + } 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]"); -- 2.0.0.5.gbce14aa -- PGP-Key 0xD40E0E7A
reopen #630 reopen #631 thanks
Hi Horst,
On Sa 04 Okt 2014 13:15:13 CEST, Horst Schirmeier wrote:
Remove stale X11 lock files in cases where x2goagent mysteriously disappeared (e.g., due to kill -9 or a crash). This fixes bug #630 (and #626, which hasn't really been fixed yet). Tested against the original scenario from bug #626.
Thanks! Will apply it tomorrow. Mike
--
DAS-NETZWERKTEAM mike gabriel, herweg 7, 24357 fleckeby fon: +49 (1520) 1976 148
GnuPG Key ID 0x25771B31 mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de
freeBusy: https://mail.das-netzwerkteam.de/freebusy/m.gabriel%40das-netzwerkteam.de.xf...
Processing commands for control@bugs.x2go.org:
reopen #630 Bug #630 {Done: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>} [x2goserver] clean up stable /tmp/.X<disp>-lock files 'reopen' may be inappropriate when a bug has been closed with a version; all fixed versions will be cleared, and you may need to re-add them. Bug reopened No longer marked as fixed in versions 4.0.1.17. reopen #631 Bug #631 {Done: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>} [x2goserver] develop X2Go Server session manager 'reopen' may be inappropriate when a bug has been closed with a version; all fixed versions will be cleared, and you may need to re-add them. Bug reopened No longer marked as fixed in versions 4.0.1.17. thanks Stopping processing here.
630: http://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=630 631: http://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=631 X2Go Bug Tracking System Contact owner@bugs.x2go.org with problems