]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/ceph_argparse.py: use a safe value for timeout 40476/head
authorKefu Chai <kchai@redhat.com>
Sun, 20 Dec 2020 05:10:16 +0000 (13:10 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 29 Mar 2021 16:16:14 +0000 (00:16 +0800)
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 <kchai@redhat.com>
(cherry picked from commit e59693fd96c34672c4c743514bd173fc70a3a544)

src/pybind/ceph_argparse.py

index ab112e794c55a933364f0508538b52c2cdbef677..f46bb5d2400d04fe8d4b968e91a4a65272ef1157 100644 (file)
@@ -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