[X2go-Commits] x2goserver.git - master (branch) updated: 3.1.0.1-28-g2747cda
X2Go dev team
git-admin at x2go.org
Fri Mar 16 00:06:31 CET 2012
The branch, master has been updated
via 2747cda3acda1531fccbd52092e08837866d60ab (commit)
via 83df64accdfbae7225d3894b49b6c0cde3124847 (commit)
via 239588d6ced18485c821c81ce305d9c8d2a2eb2f (commit)
via d285cbef38ba3d3346c7aaf09b1d06ff9e592fbb (commit)
via f1c987d5219aabd1253b9f7d20ad2a98cddd313d (commit)
via 104db977ff52500d132973cb9481373ba6e367bf (commit)
from bdf58be37831c772c5f888e267e807c87d13f3d3 (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 2747cda3acda1531fccbd52092e08837866d60ab
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Mar 16 00:05:57 2012 +0100
Improve concurrent database access with session db backend SQLite.
commit 83df64accdfbae7225d3894b49b6c0cde3124847
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Mar 16 00:04:53 2012 +0100
Silence error messages if the agent's session.log file is not accessible (e.g. on NFSv4+Krb5-mounted homes).
commit 239588d6ced18485c821c81ce305d9c8d2a2eb2f
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Mar 16 00:00:37 2012 +0100
Add/enable debugging of x2gocleansessions.
commit d285cbef38ba3d3346c7aaf09b1d06ff9e592fbb
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu Mar 15 23:58:22 2012 +0100
Fix race condition between session.log of x2goagent and x2gocleansessions. If x2goagent is now fast enough with appending the new session state to the session.log file, the x2gocleansessions script will mark the session as suspended during the session resuming process.
commit f1c987d5219aabd1253b9f7d20ad2a98cddd313d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu Mar 15 23:55:11 2012 +0100
no newline when printing the status
commit 104db977ff52500d132973cb9481373ba6e367bf
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu Mar 15 23:54:35 2012 +0100
correct changelog
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 14 ++++++++++----
x2goserver/bin/x2goresume-session | 30 +++++++++++++++++-------------
x2goserver/lib/x2gogetstatus | 2 +-
x2goserver/lib/x2gosqlitewrapper.pl | 3 ++-
x2goserver/sbin/x2gocleansessions | 16 ++++++++--------
x2goserver/sbin/x2golistsessions_root | 2 +-
6 files changed, 39 insertions(+), 28 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index f8a24d5..e5c3971 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,10 +11,16 @@ x2goserver (3.1.1.0-0~x2go1) UNRELEASED; urgency=low
by X2Go client applications to retrieve a list of server-side
supported X2Go features.
- Update date and version number in man pages.
- - Add syslogging to SQLite3 session DB backend for occuring
- DB failures.
- - If setting a session state to 'R' fails in x2goresume-session,
- simly try again.
+ - Fix race condition between session.log of x2goagent and
+ x2gocleansessions. If x2goagent is now fast enough with appending
+ the new session state to the session.log file, the x2gocleansessions
+ script will mark the session as suspended during the session
+ resuming process.
+ - Add X2Go server script x2gogetstatus.
+ - Add/enable debugging of x2gocleansessions.
+ - Silence error messages if the agent's session.log file is not accessible
+ (e.g. on NFSv4+Krb5-mounted homes).
+ - Improve concurrent database access with session db backend SQLite.
* Remove /etc/x2go/applications on package removal if it is a
symlink, keep it, if it is a directory. Remove /etc/x2go
(if empty after purge) on package purge.
diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session
index baf639a..04d2eea 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -149,25 +149,28 @@ fi
echo "$NEWOPTIONS" >"${SESSION_DIR}/options"
-# we really have to make sure the session database got 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
-
# run x2goserver-extensions for pre-resume
x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" pre-resume || true
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
+ $X2GO_LIB_PATH/x2goresume "$X2GO_CLIENT" "$SESSION_NAME" "$GR_PORT" "$SOUND_PORT" "$FS_PORT" > /dev/null
+
# resume x2godesktopsharing, if it has been in use before the session got suspended
x2gofeature X2GO_DESKTOPSHARING &>/dev/null && x2goresume-desktopsharing "$SESSION_NAME" || true
@@ -191,3 +194,4 @@ kill -HUP $X2GO_AGENT_PID &>/dev/null && {
echo "gr_port=$GR_PORT"
echo "sound_port=$SOUND_PORT"
echo "fs_port=$FS_PORT"
+
diff --git a/x2goserver/lib/x2gogetstatus b/x2goserver/lib/x2gogetstatus
index a245352..d2271a4 100755
--- a/x2goserver/lib/x2gogetstatus
+++ b/x2goserver/lib/x2gogetstatus
@@ -34,7 +34,7 @@ my $status;
my $sid=shift or die;
$status = db_getstatus($sid);
-print "$status\n";
+print "$status";
# closing syslog
closelog;
diff --git a/x2goserver/lib/x2gosqlitewrapper.pl b/x2goserver/lib/x2gosqlitewrapper.pl
index 1d8923a..bb0e621 100755
--- a/x2goserver/lib/x2gosqlitewrapper.pl
+++ b/x2goserver/lib/x2gosqlitewrapper.pl
@@ -63,7 +63,8 @@ my $dbfile="$homedir/x2go_sessions";
my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwuid($<);
my $realuser=$uname;
-my $dbh=DBI->connect("dbi:SQLite:dbname=$dbfile","","",{AutoCommit => 1}) or die $_;
+my $dbh=DBI->connect("dbi:SQLite:dbname=$dbfile","","",{sqlite_use_immediate_transaction => 1, AutoCommit => 1, }) or die $_;
+$dbh->sqlite_busy_timeout( 2000 );
my $cmd=shift or die "command not specified";
my $rc=0;
diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions
index b3f65db..6e21482 100755
--- a/x2goserver/sbin/x2gocleansessions
+++ b/x2goserver/sbin/x2gocleansessions
@@ -56,12 +56,12 @@ sub check_stat
my $sess=shift;
my $user=shift;
my $log="~$user/.x2go/C-$sess/session.log";
- my $text=`tail -1 $log`;
+ my $text=`tail -1 $log 2>/dev/null`;
if ($text =~ m/Session suspended/)
{
return 0;
}
- return 1;
+ return 1;
}
sub catch_term
@@ -101,15 +101,15 @@ elsif ($pid == 0 )
my @sinfo=split('\\|',"@outp[$i]");
if (@sinfo[4]eq 'F')
{
- #print "@sinfo[1], is blocked\n";
- #print "(@sinfo[1])Unmounting all shares\n";
+ syslog('debug', "@sinfo[1] is blocked");
+ 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], at sinfo[1], at sinfo[12]))
{
system("su @sinfo[11] -c \"$x2go_lib_path/x2gochangestatus 'F' @sinfo[1] \" > /dev/null");
- #print "@sinfo[1], pid @sinfo[0] not exist, changing status from @sinfo[4] to F\n";
- #print "(@sinfo[1])Unmounting all shares\n";
+ 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
@@ -119,8 +119,8 @@ elsif ($pid == 0 )
if (!check_stat(@sinfo[1], at sinfo[11]))
{
system("su @sinfo[11] -c \"$x2go_lib_path/x2gochangestatus 'S' @sinfo[1] \" > /dev/null");
- #print "@sinfo[1], is suspended, changing status from @sinfo[4] to S\n";
- #print "(@sinfo[1])Unmounting all shares\n";
+ syslog("@sinfo[1] is suspended, changing status from @sinfo[4] to S");
+ syslog("@sinfo[1]: unmounting all shares");
system( "su @sinfo[11] -c \"export HOSTNAME && x2goumount-session @sinfo[1]\" 2> /dev/null");
}
}
diff --git a/x2goserver/sbin/x2golistsessions_root b/x2goserver/sbin/x2golistsessions_root
index c1f0567..dddcae3 100755
--- a/x2goserver/sbin/x2golistsessions_root
+++ b/x2goserver/sbin/x2golistsessions_root
@@ -35,7 +35,7 @@ sub check_stat
my $sess=shift;
my $user=shift;
my $log="~$user/.x2go/C-$sess/session.log";
- my $text=`tail -1 $log`;
+ my $text=`tail -1 $log 2>/dev/null`;
if ($text =~ m/Session suspended/)
{
return 0;
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).
More information about the x2go-commits
mailing list