[New-bugs-announce] [issue37665] threading.TIMEOUT_MAX integer overflow on 32-bit builds with threading.Thread.join

Arun Sharma report at bugs.python.org
Tue Jul 23 19:42:44 EDT 2019


New submission from Arun Sharma <arsharma at google.com>:

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.

----------
files: timeout_max_32_bit.py
messages: 348358
nosy: Arun Sharma
priority: normal
severity: normal
status: open
title: threading.TIMEOUT_MAX integer overflow on 32-bit builds with threading.Thread.join
type: behavior
versions: Python 3.7
Added file: https://bugs.python.org/file48501/timeout_max_32_bit.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37665>
_______________________________________


More information about the New-bugs-announce mailing list