This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit a35aa9c5a7eaeaea164dda0e0069265359417540 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. Cherry-picked from release/4.0.1.x branch. --- debian/changelog | 2 ++ x2goserver/sbin/x2gocleansessions | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 13e7288..92bb7a3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -203,6 +203,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 7d28c05..81dcf4a 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -273,12 +273,20 @@ elsif ($pid == 0 ) } if (@sinfo[4] eq 'S') { - if (session_is_running(@sinfo[1],@sinfo[11])) - { - log_message('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]"); - log_message('debug', "@sinfo[1] was found running and has now been suspended"); + if (session_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) { + log_message('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]"); + log_message('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. + log_message('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