Subject: x2gocleansessions suspends resuming sessions

From: Florian Wicke - Hetzner Online AG <[email-masked]>
Date: Thu, 18 Jun 2015 08:33:46 +0200

Package: x2goserver
Version: 4.1.0.0-0~1281~ubuntu14.04.1

Current workflow of x2gocleansessions:

- read the sessions from database
- loop over this session list
-> check state of session (S,R,...)
-> if state S (suspended) check if session is running
-> if the session that should be suspended in the datase is running then
suspend the session

Unfortunately this leads to the following problem:
If you have many sessions the time between generating the session list
from the database and the "is_running"-checks of sessions at the end of
the list is enough as time window that a user can log in via x2goclient
and getting logged out because x2gocleansessions suspends the now
running/resumed session.

Suggestions to fix:
Reread the state of the session from the database on each iteration of
the session-list-loop to minimize the timeframe between database read
and check execution and use counters like "the check has to be the same
result for the last three "sleep 2"-big-loop-runs of x2gocleansessions"
because the extra seconds don't matter in a valid case of unsuspended
sessions but matter a lot to fix this bug.

-- 
Kind regards

 Florian Wicke

Hetzner Online AG
Industriestr. 25
91710 Gunzenhausen / Germany
Tel: +49 9831 505-187
Fax: +49 9831 505-387
[email-masked]
www.hetzner.com

Register Court: Registergericht Ansbach, HRB 3204
Management Board: Dipl. Ing. (FH) Martin Hetzner
Chairwoman of the Supervisory Board: Diana Rothhan