From e59693fd96c34672c4c743514bd173fc70a3a544 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sun, 20 Dec 2020 13:10:16 +0800 Subject: [PATCH] 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 --- src/pybind/ceph_argparse.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pybind/ceph_argparse.py b/src/pybind/ceph_argparse.py index 6e3a7b8e6dc..53faf3cbce5 100644 --- a/src/pybind/ceph_argparse.py +++ b/src/pybind/ceph_argparse.py @@ -1312,9 +1312,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 -- 2.39.5