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.

classification
Title: threading.TIMEOUT_MAX integer overflow on 32-bit builds with threading.Thread.join
Type: behavior Stage: resolved
Components: Versions: Python 3.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: undefined behaviour: signed integer overflow in threadmodule.c
View: 33632
Assigned To: Nosy List: Arun Sharma, ZackerySpytz
Priority: normal Keywords:

Created on 2019-07-23 23:42 by Arun Sharma, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
timeout_max_32_bit.py Arun Sharma, 2019-07-23 23:42 Demonstration of timeout's immediate return
Messages (2)
msg348358 - (view) Author: Arun Sharma (Arun Sharma) Date: 2019-07-23 23:42
threading's TIMEOUT_MAX constant causes overflows when used as the timeout for threading.Thread.join on a 32-bit platform, like a Raspberry PI running Raspbian (2019-07-10-raspbian-buster).

The underlying code uses sem_timedwait.  The timespec on this platform resolves seconds to a 32-bit integer, adding the current time to the timeout to get a deadline.

====
>>> import threading
>>> threading.TIMEOUT_MAX
9223372036.0
====

The deadline is larger than the int32 UNIX Epoch and results in an overflow.

Just changing the threading.TIMEOUT_MAX to be based on the time left until the UNIX Epoch would require changing the timeout over the duration of the program and would not be very viable as the Epoch gets closer.
msg348361 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-07-24 03:19
See also bpo-33632.
History
Date User Action Args
2022-04-11 14:59:18adminsetgithub: 81846
2022-03-24 15:37:26iritkatrielsetstatus: open -> closed
superseder: undefined behaviour: signed integer overflow in threadmodule.c
resolution: duplicate
stage: resolved
2019-07-24 03:19:40ZackerySpytzsetnosy: + ZackerySpytz
messages: + msg348361
2019-07-23 23:42:44Arun Sharmacreate