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 8592542c60e3499f2037656ba7ad033fe84cc49b Author: Mihai Moldovan <ionic@ionic.de> Date: Sun Jun 21 23:28:04 2015 +0200 x2goserver/sbin/x2gocleansessions: give suspended-but-running sessions a grace period of one iteration. Fixes: #888. --- debian/changelog | 2 ++ x2goserver/sbin/x2gocleansessions | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index cb9c2cc..0458a3d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,8 @@ x2goserver (4.0.1.20-0x2go1) UNRELEASED; urgency=low %remembered_sessions_status_since_time. Add %remembered_sessions_status_since_iterations that will come in handy for the next change. + - x2goserver/sbin/x2gocleansessions: give suspended-but-running sessions a + grace period of one iteration. Fixes: #888. * x2goserver.spec: - Add sudo and logcheck as BuildRequires and Requires. Don't own directories that are owned by sudo and logcheck. Logcheck is not diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index 1d82b6e..40aecdb 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -269,12 +269,20 @@ elsif ($pid == 0 ) } if (@sinfo[4] eq 'S') { - if (is_running(@sinfo[1],@sinfo[11])) - { - syslog('debug', "@sinfo[1]: unmounting all shares"); - system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "export HOSTNAME && x2goumount-session @sinfo[1]"); - system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2gosuspend-session @sinfo[1]"); - syslog('debug', "@sinfo[1] was found running and has now been suspended"); + if (is_running(@sinfo[1],@sinfo[11])) { + # Give the session a grace period of one iteration. + # If it didn't change into suspended state by then, suspend it "forcefully". + if ($remembered_sessions_status_since_iterations{@sinfo[1]} == 1) { + syslog('debug', "@sinfo[1]: unmounting all shares"); + system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "export HOSTNAME && x2goumount-session @sinfo[1]"); + system("su", "@sinfo[11]", "-s", "/bin/sh", "-c", "x2gosuspend-session @sinfo[1]"); + syslog('debug', "@sinfo[1] was found running and has now been suspended"); + } + elsif ($remembered_sessions_status_since_iterations{@sinfo[1]} == 2) { + # Issue a diagnostic warning in case suspension was already tried, but failed to + # actually change the status for some reason. + syslog('warning', "@sinfo[1]: session status @sinfo[4] desynchronized with current status (R) and session suspend already tried unsuccessfully"); + } } } if (@sinfo[4] eq 'T') -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git