Bug 52273 - UMC-Web-Server: don't count down session timeout second wise
UMC-Web-Server: don't count down session timeout second wise
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC (Generic)
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 4.4-7-errata
Assigned To: Florian Best
Jürn Brodersen
:
Depends on: 52272
Blocks:
  Show dependency treegraph
 
Reported: 2020-10-28 11:47 CET by Florian Best
Modified: 2021-01-14 17:05 CET (History)
4 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional): Cleanup, Large environments, UCS Performance
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2020-10-28 11:47:16 CET
The UMC-Web-Server counts down session timeouts second wise.

This is because of Bug #24943 (git:5cdc3849dd5), where the system time is changed via rdate during the join which then invalids all sessions if the time is not synchron with the DC Master.

We should evaluate if we can solve this in a different way, e.g. detecting a system change in the daemon, (restarting services during join? - probably not), etc.

The same might apply to the UMC-Server and module processes.

+++ This bug was initially created as a clone of Bug #52272 +++
Comment 1 Florian Best univentionstaff 2020-10-29 10:40:05 CET
Python >= 3.3 provides time.monotonic():
https://docs.python.org/3/library/time.html#time.monotonic
Comment 2 Florian Best univentionstaff 2020-11-26 21:35:07 CET
see also git:79ad2a2e1c375f5d3b1e80324cbe3abfffbf8895 (Bug #42174)
Comment 3 Florian Best univentionstaff 2020-11-30 22:27:07 CET
(In reply to Florian Best from comment #1)
> Python >= 3.3 provides time.monotonic():
> https://docs.python.org/3/library/time.html#time.monotonic
There is a Python 2.7 backport in python-monotonic.

We will fix python-notifier to use this.

Then we can use the logic from before Bug #24943.
Comment 4 Florian Best univentionstaff 2020-11-30 22:30:59 CET
A test script which also verifies that sessions are correctly closed and timers removed when the session times out but there are still open requests is:

import time
import threading
from univention.lib.umc import Client
c = Client()
c.authenticate('Administrator', 'univention')

def ping():
    print('Started thread')
    print(c.umc_command('setup/ping', options={'keep_alive': True}).result)


t = threading.Thread(target=ping)
t.start()

try:
    while True:
        print(c.umc_get('session-info').result)
        time.sleep(5)
except KeyboardInterrupt:
    pass

#t.join()

# python -i test_st.py
# ucr set umc/http/session/timeout='15'; systemctl restart univention-management-console-web-server
# sleep 15
# pkill -f console-module
Comment 5 Florian Best univentionstaff 2020-12-01 16:16:41 CET
The monotonic time approach has been implemented in python-notifier.
Package: python-notifier
Version: 0.9.7-8A~4.4.0.202012011529
Branch: ucs_4.4-0
Scope: errata4.4-7

The timers have been restored to behavior similar before git:5cdc3849dd5e70055a2c35fdd950532aaac8cb43.

Unfortionately I used Bug #52272 in one commit message.

univention-management-console.yaml
548722752eab | YAML Bug #52371, Bug #52443, Bug #52442, Bug #52444, Bug #52293, Bug #52272

univention-management-console (11.0.5-24)
37ac7a357a63 | Bug #52273: don't count down session timeout second wise

univention-management-console (11.0.5-24)
021e0ee2a6d4 | Bug #52272: cleanup all sessions with one timer
Comment 6 Julia Bremer univentionstaff 2020-12-02 09:23:55 CET
python-monotonic is not installable under 4.4-7, which leads to univention-ldap-server not being installable, which lead to all our jenkins tests failing, due to /etc/machine.secret missing.
http://jenkins.knut.univention.de:8080/job/UCS-4.4/job/UCS-4.4-7/job/AutotestJoin/
Comment 7 Julia Bremer univentionstaff 2020-12-02 09:47:50 CET
python-monotonic is unmaintained and needs to be moved to maintained to solve this issue.
Comment 8 Felix Botner univentionstaff 2020-12-02 11:57:50 CET
added python-monotonic to maintained

780395c760c5be1f363873dfeb324246c08f6ced - yaml

svn r83155 added to trigger list ucs_4.4-0-ucs4.4-7.txt

cd /var/univention/buildsystem2/apt/ucs_4.4-0-errata4.4-7
/home/fbotner/git/toolshed/REPO/repo-copy-dsc  -v ../ucs_4.3-0/source/python-monotonic_1.1-2.dsc
repo-apt-ftparchive .
waited for jenkins CalculateMaintained
started Publish UCS 4.4 errata test scopes to testing
Comment 9 Jürn Brodersen univentionstaff 2020-12-08 11:44:59 CET
> added python-monotonic to maintained
> 
> 780395c760c5be1f363873dfeb324246c08f6ced - yaml
> 
> svn r83155 added to trigger list ucs_4.4-0-ucs4.4-7.txt
> 
> cd /var/univention/buildsystem2/apt/ucs_4.4-0-errata4.4-7
> /home/fbotner/git/toolshed/REPO/repo-copy-dsc  -v
> ../ucs_4.3-0/source/python-monotonic_1.1-2.dsc
> repo-apt-ftparchive .
> waited for jenkins CalculateMaintained
> started Publish UCS 4.4 errata test scopes to testing

OK
Comment 10 Jürn Brodersen univentionstaff 2020-12-08 13:09:40 CET
What I tested:
Upgrade -> OK
Login -> OK
Login SAML -> OK
users/user -> OK
jenkins -> OK
session timeout -> OK
python-monotonic -> "Get:7 http://updates-test.software-univention.de/4.4/maintained/component 4.4-7-errata-test/all/ python-monotonic 1.1-2 [5,210 B]" -> OK
YAML -> OK
Comment 11 Jürn Brodersen univentionstaff 2020-12-08 13:11:23 CET
Merge 5.0 -> OK