From: Kefu Chai Date: Sun, 20 Dec 2020 05:10:16 +0000 (+0800) Subject: pybind/ceph_argparse.py: use a safe value for timeout X-Git-Tag: v15.2.13~13^2~2^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40476%2Fhead;p=ceph.git pybind/ceph_argparse.py: use a safe value for timeout we have reports that on arm32 machines, it timed out immediately, so to prevent it from int overflow, use a safer value instead of (1 << (32 - 1)) - 1. Signed-off-by: Kefu Chai (cherry picked from commit e59693fd96c34672c4c743514bd173fc70a3a544) --- diff --git a/src/pybind/ceph_argparse.py b/src/pybind/ceph_argparse.py index ab112e794c55..f46bb5d2400d 100644 --- a/src/pybind/ceph_argparse.py +++ b/src/pybind/ceph_argparse.py @@ -1317,9 +1317,11 @@ def run_in_thread(func, *args, **kwargs): if timeout == 0 or timeout == None: # python threading module will just get blocked if timeout is `None`, # otherwise it will keep polling until timeout or thread stops. - # wait for INT32_MAX, as python 3.6.8 use int32_t to present the - # timeout in integer when converting it to nanoseconds - timeout = (1 << (32 - 1)) - 1 + # timeout in integer when converting it to nanoseconds, but since + # python3 uses `int64_t` for the deadline before timeout expires, + # we have to use a safe value which does not overflow after being + # added to current time in microseconds. + timeout = 24 * 60 * 60 t = RadosThread(func, *args, **kwargs) # allow the main thread to exit (presumably, avoid a join() on this