New submission from Arun Sharma <arsha...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue37665>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to