Bug 2003758

Summary: threading wait(timeout) doesn't return after timeout if system clock is set backward
Product: Red Hat Enterprise Linux 8 Reporter: Lukáš Zachar <lzachar>
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: mark, pviktori, torsava, vstinner
Target Milestone: rcKeywords: Triaged
Target Release: 8.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3-3.6.8-44.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-10 14:55:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukáš Zachar 2021-09-13 15:37:06 UTC
Description of problem:

threading.Event().wait() is affected when system clock changes. 
This was fixed for python2 in bug 1368076 but change didn't reach python3


Version-Release number of selected component (if applicable):
all python3.x available on RHEL-8 (3.6, 3.8 and 3.9)

How reproducible:
always

Steps to Reproduce:
1. Call 'threading.Event().wait(5)'
2. Move time backwards 'date -s "-5 minutes"

Actual results:
Wait doesn't return after 5 seconds

Expected results:


Additional info:
Upstream issue https://bugs.python.org/issue41710

Comment 1 Victor Stinner 2021-10-06 11:59:40 UTC
threading.Event is implemented with threading.Condition. Python 3.8 can now uses a monotonic clock for threading.Condition: pthread_condattr_setclock(CLOCK_MONOTONIC).

See: https://bugs.python.org/issue12822


> Upstream issue https://bugs.python.org/issue41710

This issue is about threading.Lock. Python 3.11 can now use a monotonic clock for threading.Lock: sem_clockwait(lock, CLOCK_MONOTONIC, timeout). It requires glibc 2.30 or newer.

I backported the change to Python 3.9 and 3.10 branches upstream.

Comment 10 errata-xmlrpc 2022-05-10 14:55:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: python3 security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:1986

Comment 11 Victor Stinner 2022-05-17 16:35:54 UTC
I'm happy to see python3 fixed in RHEL8 :-) Thanks Charalampos and Lukáš!