This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch master in repository x2goserver. from aef470fe x2goserver.spec: X2Go KDrive package has been renamed to xorg-x11-server-x2gokdrive to be in line with general RPM package names. new ec179538 x2goserver-common/etc/x2goserver.conf: add x2gocleansessions section and agent-startup-time configurable option, to be set to the allowed time period in seconds between session creation and agent PID insertion into the database. new 3430b7c0 x2goserver/sbin/x2gocleansessions: fetch and sanity-check x2gocleansessions.agent-startup-time from config file. new 1a0fc87a x2goserver/sbin/x2gocleansessions: rework comment explaining what a session without an agent PID entry actually means and use the value from x2gocleansessions.agent-startup-time (if valid) instead of a hardcoded value. The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 10 +++++++++ x2goserver-common/etc/x2goserver.conf | 15 ++++++++++++++ x2goserver/sbin/x2gocleansessions | 38 +++++++++++++++++++++++++++++++---- 3 files changed, 59 insertions(+), 4 deletions(-) -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 1a0fc87a2956f9dd50617f115f430cd0596f16ef Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Feb 28 15:20:33 2020 +0100 x2goserver/sbin/x2gocleansessions: rework comment explaining what a session without an agent PID entry actually means and use the value from x2gocleansessions.agent-startup-time (if valid) instead of a hardcoded value. --- debian/changelog | 4 ++++ x2goserver/sbin/x2gocleansessions | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 5b43f0fc..79d7de01 100644 --- a/debian/changelog +++ b/debian/changelog @@ -174,6 +174,10 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium the database. - x2goserver/sbin/x2gocleansessions: fetch and sanity-check x2gocleansessions.agent-startup-time from config file. + - x2goserver/sbin/x2gocleansessions: rework comment explaining what a + session without an agent PID entry actually means and use the value from + x2gocleansessions.agent-startup-time (if valid) instead of a hardcoded + value. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index 047328c9..686a3f4e 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -204,9 +204,21 @@ elsif ($pid == 0 ) my @sinfo=split('\\|',"@outp[$i]"); - # Clean up invalid sessions (i.e., those for which no nxagent process is running anymore) - # from the session database, if the status didn't change for more than 10 seconds. - if ((!@sinfo[0]) && (defined ($remembered_sessions_status_since_time{@sinfo[1]})) && ((time () - $remembered_sessions_status_since_time{@sinfo[1]}) >= 10)) + # Clean up invalid sessions (i.e., those for which nxagent failed to spawn to begin with) + # from the session database, if the status didn't change for more than X seconds. + # The agent PID field (@sinfo[0]) is currently only updated through the createsession + # function, which assigns a value. + # This value is *not* automatically removed from the DB if the process dies, so, + # crucially, the only situations in which the agent PID can be empty/NULL are the early + # stage of session creation, specifically: + # - between calling insertsession (which creates a new session entry) and createsession + # (which populates a session entry with additional data, including the agent PID) + # - if spawning nxagent never succeeded, which is really just a special case of the + # above, since insertsession was called but createsession never will be. + # Originally, the "allowed nxagent startup time" was hardcoded to 10 seconds, but we + # encountered situations/machines that need much longer to spawn nxagent, so this was + # made configurable. + if ((!@sinfo[0]) && (defined ($remembered_sessions_status_since_time{@sinfo[1]})) && ((time () - $remembered_sessions_status_since_time{@sinfo[1]}) >= $agent_startup_time)) { dbsys_rmsessionsroot(@sinfo[1]); next; -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit ec179538f14e6094c061cf148a130e94ad818bd5 Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Feb 28 15:16:36 2020 +0100 x2goserver-common/etc/x2goserver.conf: add x2gocleansessions section and agent-startup-time configurable option, to be set to the allowed time period in seconds between session creation and agent PID insertion into the database. --- debian/changelog | 4 ++++ x2goserver-common/etc/x2goserver.conf | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/debian/changelog b/debian/changelog index 1c84c243..ac43b499 100644 --- a/debian/changelog +++ b/debian/changelog @@ -168,6 +168,10 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium - x2goserver/bin/x2gopath.in: make xinerama path optional, newer releases don't use it any longer, so failures to find it should not result in a warning message. + - x2goserver-common/etc/x2goserver.conf: add x2gocleansessions section and + agent-startup-time configurable option, to be set to the allowed time + period in seconds between session creation and agent PID insertion into + the database. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver-common/etc/x2goserver.conf b/x2goserver-common/etc/x2goserver.conf index fe20cf08..9ae77f3b 100644 --- a/x2goserver-common/etc/x2goserver.conf +++ b/x2goserver-common/etc/x2goserver.conf @@ -47,6 +47,21 @@ enable=no # variable to fully randomize the port, i.e., 30000 + random(0..32767). port_randomization="pure-random" +[x2gocleansessions] +# Time allowed between session creation and agent PID DB insertion in seconds. +# If a session exceeds this time and no agent PID has been recorded, it will be +# regarded as invalid and evicted from the database. +# Negative values are not allowed. +# The default is 10 seconds. +# Lower values are explicitly NOT recommended. Correctly starting and running +# sessions might be getting falsely evicted and session suspension, resumption +# or termination will not work. +# Slow machines or those with unusual setups, like NFS-based or remote cluster +# root file systems, might need to be configured with a higher value. Setting +# a very high value might lead to the session database piling up with invalid, +# stale sessions. +agent-startup-time=10 + [log] # possible levels are: emerg, alert, crit, err, warning, notice, info, debug loglevel=notice -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 3430b7c04ea520cee11252c27166972519e01bae Author: Mihai Moldovan <ionic@ionic.de> Date: Fri Feb 28 15:18:57 2020 +0100 x2goserver/sbin/x2gocleansessions: fetch and sanity-check x2gocleansessions.agent-startup-time from config file. --- debian/changelog | 2 ++ x2goserver/sbin/x2gocleansessions | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index ac43b499..5b43f0fc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -172,6 +172,8 @@ x2goserver (4.1.0.4-0x2go1.2) UNRELEASED; urgency=medium agent-startup-time configurable option, to be set to the allowed time period in seconds between session creation and agent PID insertion into the database. + - x2goserver/sbin/x2gocleansessions: fetch and sanity-check + x2gocleansessions.agent-startup-time from config file. * debian/control: + Build-depend upon lsb-release for distro version detection. * debian/x2goserver.manpages: diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index 48521377..047328c9 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -32,7 +32,7 @@ use X2Go::Log qw( loglevel ); use X2Go::SupeReNicer qw( superenice ); use X2Go::Server::Agent qw( session_is_suspended session_is_running session_has_terminated ); use X2Go::Server::DB qw( dbsys_rmsessionsroot ); -use X2Go::Utils qw( system_capture_stdout_output is_true ); +use X2Go::Utils qw( system_capture_stdout_output is_true is_int ); my $x2go_lib_path = system_capture_stdout_output("x2gopath", "libexec"); use Getopt::Long; use Pod::Usage; @@ -121,6 +121,24 @@ elsif ($pid == 0 ) # of suspended sessions... my $Config = get_config(); + my $agent_startup_time = $Config->param ("x2gocleansessions.agent-startup-time"); + if (!(is_int ($agent_startup_time, 0))) { + log_message ('warning', "Agent startup time \"$agent_startup_time\" invalid/not an integer, overriding with default of 10."); + $agent_startup_time = 10; + } + else { + # Sanity checks. + if ($agent_startup_time < 10) { + log_message ('info', "Agent startup time of $agent_startup_time seconds is very low, false evictions are likely."); + log_message ('info', "Consider raising the agent startup time."); + } + + if ($agent_startup_time > 120) { + log_message ('info', "Agent startup time of $agent_startup_time seconds is very high, invalid/stale session startup attempts may clutter the database."); + log_message ('info', "Consider lowering the agent startup time."); + } + } + my $superenice_enable = is_true($Config->param("superenicer.enable")); my $superenice_forceuser = is_true($Config->param("superenicer.force-user-renice")); -- Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git