This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author aclover
Recipients aclover, paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-03-04.13:20:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1583328026.98.0.491106865905.issue39847@roundup.psfhosted.org>
In-reply-to
Content
Since bpo-15038, waiting to acquire locks/events/etc from _thread/threading on Windows can fail to return long past the requested timeout. Cause:

https://github.com/python/cpython/blob/3.8/Python/thread_nt.h#L85

using 32-bit GetTickCount/DWORD, which will overflow at around 49.7 days of uptime.

If the WaitForSingleObjectEx call in PyCOND_TIMEDWAIT returns later than the 'target' time, and the tick count overflows in that gap, 'milliseconds' will become very large (up to another 49.7 days) and the next PyCOND_TIMEDWAIT will be stuck for a long time.

Where we've seen it is where it's most likely to happen: when the machine is hibernated during the WaitForSingleObjectEx call. I believe the TickCount continues to increase during hibernation so there is a much bigger gap between 'target' and 'now' for the overflow to happen in.

Simplest fix is probably to switch to GetTickCount64/ULONGLONG. We should be able to get away with using this now we no longer support WinXP.
History
Date User Action Args
2020-03-04 13:20:27acloversetrecipients: + aclover, paul.moore, tim.golden, zach.ware, steve.dower
2020-03-04 13:20:26acloversetmessageid: <1583328026.98.0.491106865905.issue39847@roundup.psfhosted.org>
2020-03-04 13:20:26acloverlinkissue39847 messages
2020-03-04 13:20:26aclovercreate