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