The branch, master has been updated via 435bc378553a215b05ed65e1da3694925972ab63 (commit) from eb1f31f259dd51fcf7245c05e83f3d64371cc261 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 435bc378553a215b05ed65e1da3694925972ab63 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sat Jun 22 11:46:48 2013 +0200 Accelerate resuming of sessions. Fix failures when resuming sessions that result from the latest changes in x2gocleansessions. (Fixes: #247). ----------------------------------------------------------------------- Summary of changes: debian/changelog | 8 ++++++ x2goserver/bin/x2goresume-session | 18 ++----------- x2goserver/sbin/x2gocleansessions | 54 ++++++++++++++++++------------------- 3 files changed, 37 insertions(+), 43 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 19a3e4d..80bcb63 100644 --- a/debian/changelog +++ b/debian/changelog @@ -51,6 +51,14 @@ x2goserver (4.1.0.0-0~x2go1) UNRELEASED; urgency=low -- Reinhard Tartler <siretart@tauware.de> Thu, 20 Dec 2012 10:15:26 +0100 +x2goserver (4.0.1.2-0~x2go1) UNRELEASED; urgency=low + + * New upstream version (4.0.1.2): + - Accelerate resuming of sessions. Fix failures when resuming sessions that + result from the latest changes in x2gocleansessions. (Fixes: #247). + + -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Sat, 22 Jun 2013 11:01:21 +0200 + x2goserver (4.0.1.1-0~x2go1) unstable; urgency=low * New upstream version (4.0.1.1): diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session index 75d06d0..3d01b0a 100755 --- a/x2goserver/bin/x2goresume-session +++ b/x2goserver/bin/x2goresume-session @@ -159,23 +159,9 @@ x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSI rm -Rf $SESSION_DIR/keyboard kill -HUP $X2GO_AGENT_PID &>/dev/null && { - $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "client $X2GO_CLIENT has successfully resumed session with ID $SESSION_NAME" - # FIXME: the below code may not be necessary as we fixed a race condition between x2gocleansessions and x2goagent - - # we really have to make sure the session database gets this write operation - # this may just be an SQLite issue so... - # FIXME: probably migrate this piece of code to the SQLite db backend... - #while true; do - # $X2GO_LIB_PATH/x2goresume "$X2GO_CLIENT" "$SESSION_NAME" "$GR_PORT" "$SOUND_PORT" "$FS_PORT" > /dev/null - # if [ $($X2GO_LIB_PATH/x2gogetstatus "$SESSION_NAME") == "R" ]; then - # break; - # else - # $X2GO_LIB_PATH/x2gosyslog "$0" "warning" "failed to write to X2Go db, will try again..." - # sleep 1; - # fi - #done - (sleep 1; $X2GO_LIB_PATH/x2goresume "$X2GO_CLIENT" "$SESSION_NAME" "$GR_PORT" "$SOUND_PORT" "$FS_PORT" > /dev/null;) + $X2GO_LIB_PATH/x2goresume "$X2GO_CLIENT" "$SESSION_NAME" "$GR_PORT" "$SOUND_PORT" "$FS_PORT" > /dev/null + $X2GO_LIB_PATH/x2gosyslog "$0" "notice" "client $X2GO_CLIENT has successfully resumed session with ID $SESSION_NAME" # set client-side keyboard model, type, variant, etc. if [ "$X2GO_SET_KBD" != "0" ] && [ "$X2GO_KBD_TYPE" == "auto" ]; then diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index 22edbbd..6dc9b5d 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -79,8 +79,6 @@ sub is_running { my $sess=shift; my $user=shift; - my $log="/tmp/.x2go-${user}/session-C-${sess}.log"; - my $text=`tail -1 $log 2>/dev/null`; if (!is_suspended($sess, $user) && !has_terminated($sess, $user)) { return 1; @@ -116,7 +114,7 @@ elsif ($pid == 0 ) $SIG{TERM}=\&catch_term; $SIG{CHLD} = sub { wait }; - my %blocked_sessions = (); + my %remembered_sessions = (); while(sleep 2) { @@ -124,74 +122,76 @@ elsif ($pid == 0 ) my @outp=split("\n","$outp"); # forget earlier remembered blocked sessions - while ( my ($session, $blocked_time) = each(%blocked_sessions) ) + while ( my ($session, $remembered_time) = each(%remembered_sessions) ) { if (! join(',', @outp)=~m/$session/) { - delete $blocked_sessions{$session}; + delete $remembered_sessions{$session}; } } for (my $i=0;$i<@outp;$i++) { + my @sinfo=split('\\|',"@outp[$i]"); - if (@sinfo[4]eq 'F') + + if (defined $remembered_sessions{ @sinfo[1] }) { + $remembered_sessions{ @sinfo[1] } += 2; + } else { + $remembered_sessions{ @sinfo[1] } = 0; + } + if (@sinfo[4]eq 'F') + { syslog('debug', "@sinfo[1] is blocked"); - if (defined $blocked_sessions{ @sinfo[1] }) + if ($remembered_sessions{@sinfo[1]} ge 20) { - $blocked_sessions{@sinfo[1]} += 2; - if ($blocked_sessions{@sinfo[1]} >= 20) - { - # send SIGKILL to dangling X-server processes - syslog('warning', "@sinfo[1]: found stale X-server process (@sinfo[0]), sending SIGKILL"); - qw(kill -9 @sinfo[0]); - delete $blocked_sessions{@sinfo[1]}; - } - } else { - $blocked_sessions{@sinfo[1]} = 0; - syslog('debug', "@sinfo[1]: unmounting all shares"); - system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null"); + # send SIGKILL to dangling X-server processes + syslog('warning', "@sinfo[1]: found stale X-server process (@sinfo[0]), sending SIGKILL"); + qw(kill -9 @sinfo[0]); + delete $remembered_sessions{@sinfo[1]}; } - + syslog('debug', "@sinfo[1]: unmounting all shares"); + system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null"); } + elsif (! check_pid (@sinfo[0],@sinfo[1],@sinfo[12])) { - system("su @sinfo[11] -c \"$x2go_lib_path/x2gochangestatus 'F' @sinfo[1] \" > /dev/null"); + system("su @sinfo[11] -c \"$x2go_lib_path/x2gochangestatus 'F' @sinfo[1] \" 1> /dev/null 2> /dev/null"); 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> /dev/null"); } else { - if (@sinfo[4]eq 'R') + if ( (@sinfo[4] eq 'R') && ( $remembered_sessions{ @sinfo[1] } ge 2 )) { if (is_suspended(@sinfo[1],@sinfo[11])) { - system("su @sinfo[11] -c \"$x2go_lib_path/x2gochangestatus 'S' @sinfo[1] \" > /dev/null"); + system("su @sinfo[11] -c \"$x2go_lib_path/x2gochangestatus 'S' @sinfo[1] \" 1> /dev/null 2>/dev/null"); syslog('debug', "@sinfo[1] is suspended, changing status from @sinfo[4] to S"); syslog('debug', "@sinfo[1]: unmounting all shares"); system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null"); } } - if (@sinfo[4]eq 'S') + if (@sinfo[4] eq 'S') { if (is_running(@sinfo[1],@sinfo[11])) { syslog('debug', "@sinfo[1]: unmounting all shares"); system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null"); - system("su @sinfo[11] -c \"x2gosuspend-session @sinfo[1] \" > /dev/null"); + system("su @sinfo[11] -c \"x2gosuspend-session @sinfo[1] \" 1> /dev/null 2>/dev/null"); syslog('debug', "@sinfo[1] was found running and has now been suspended"); } } - if (@sinfo[4]eq 'T') + if (@sinfo[4] eq 'T') { if (!has_terminated(@sinfo[1],@sinfo[11])) { syslog('debug', "@sinfo[1]: unmounting all shares"); system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null"); - system("su @sinfo[11] -c \"x2goterminate-session @sinfo[1] \" > /dev/null"); + system("su @sinfo[11] -c \"x2goterminate-session @sinfo[1] \" 1> /dev/null 2>/dev/null"); syslog('debug', "@sinfo[1] has been requested for termination via the session DB"); } } hooks/post-receive -- x2goserver.git (X2Go Server) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "x2goserver.git" (X2Go Server).