Received: (at submit) by bugs.x2go.org; 18 Jun 2015 06:33:11 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,URIBL_BLOCKED
	autolearn=ham version=3.3.2
Received: from mail.hetzner.company (mail.hetzner.company [213.133.106.242])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTPS id F377E5DA82
	for <submit@bugs.x2go.org>; Thu, 18 Jun 2015 08:33:08 +0200 (CEST)
Received: from [78.46.134.130] (helo=[10.200.1.57])
	by mail.hetzner.company with esmtpsa (TLSv1.2:DHE-RSA-AES256-SHA:256)
	(Exim 4.80)
	(envelope-from <florian.wicke@hetzner.de>)
	id 1Z5TPM-0001wz-EF
	for submit@bugs.x2go.org; Thu, 18 Jun 2015 08:34:40 +0200
Message-ID: <5582664A.90506@hetzner.de>
Date: Thu, 18 Jun 2015 08:33:46 +0200
From: Florian Wicke - Hetzner Online AG <florian.wicke@hetzner.de>
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
MIME-Version: 1.0
To: submit@bugs.x2go.org
Subject: x2gocleansessions suspends resuming sessions
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature";
 boundary="1pQI40pEDqomWNBbxDQiGF2JXbb57bF0u"
X-Authenticated-Sender: florian.wicke@hetzner.de

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--1pQI40pEDqomWNBbxDQiGF2JXbb57bF0u
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

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.




--=20
Kind regards

 Florian Wicke

Hetzner Online AG
Industriestr. 25
91710 Gunzenhausen / Germany
Tel: +49 9831 505-187
Fax: +49 9831 505-387
florian.wicke@hetzner.de
www.hetzner.com

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


--1pQI40pEDqomWNBbxDQiGF2JXbb57bF0u
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCgAGBQJVgmZKAAoJEAn0falXoNhD5Y8IAKSH7AlhQIKLBuSVHYCT4eF4
QTwaEPikwBfC7JJ4ptiPSizDRTUWHjQ8OKAxsGDTQefuz1Stf8/pveOJ0Xgy7ZVq
3vGJS8EEOaouf+RWBnzh+mN9bPPJEyIvEHEjAJ8Y75ni1c0SQiJ9Be/8DFXpENv6
dWRHZEg1b16rVCHGxUKZYRPPyvicOz5LAP62kt1zA+oqME1XW6/4wQntF1w6biNn
dGGTQTWNaRPtU9UO4Hw3Sb96A1HjqWlRFi5ZPG1fUCTAGCF7thv0js9INukO7Ikn
FhRmXjxvUQr4/6oYLrH0RXCpqyK6bH7KjS/dqhaa/4K3DDeapuuqZy6vOFhWpQk=
=TM4b
-----END PGP SIGNATURE-----

--1pQI40pEDqomWNBbxDQiGF2JXbb57bF0u--
