[Lldb-commits] [lldb] [lldb] Increase MAX_ATTEMPTS in connect_to_debug_monitor() (PR #118222)
Dmitry Vasilyev via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 2 03:17:50 PST 2024
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/118222
>From bb68e6d523f3e80b991c7370bb00bac2bb9582b6 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Sun, 1 Dec 2024 21:35:52 +0400
Subject: [PATCH 1/2] [lldb] Increase MAX_ATTEMPTS in
connect_to_debug_monitor()
See #118032 for details.
---
.../lldbsuite/test/tools/lldb-server/gdbremote_testcase.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index 8c8e4abed0b454..67b07ff4ddd998 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -388,7 +388,7 @@ def connect_to_debug_monitor(self, attach_pid=None):
# We're using a random port algorithm to try not to collide with other ports,
# and retry a max # times.
attempts = 0
- MAX_ATTEMPTS = 20
+ MAX_ATTEMPTS = 30
while attempts < MAX_ATTEMPTS:
server = self.launch_debug_monitor(attach_pid=attach_pid)
>From a9a7e4e50d788aeb22bfe94a4ca580e9045882e3 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev <dvassiliev at accesssoftek.com>
Date: Mon, 2 Dec 2024 15:17:28 +0400
Subject: [PATCH 2/2] Added an exponential algorithm for the sleep time.
Reduced MAX_ATTEMPTS to 16. The sleep time will be 3, 3.6, 4.3, ..., 38, 46.
The total sleep time is 262 + 0.5*MAX_CONNECT_ATTEMPTS*MAX_ATTEMPTS = 342.
Note the timeout is 600, so the rest time must be enough. Increased the port
range (12000..20000).
---
.../test/tools/lldb-server/gdbremote_testcase.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
index 67b07ff4ddd998..04d39bfc74299c 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -185,7 +185,7 @@ def setUpServerLogging(self, is_llgs):
]
def get_next_port(self):
- return 12000 + random.randint(0, 3999)
+ return 12000 + random.randint(0, 7999)
def reset_test_sequence(self):
self.test_sequence = GdbRemoteTestSequence(self.logger)
@@ -388,7 +388,8 @@ def connect_to_debug_monitor(self, attach_pid=None):
# We're using a random port algorithm to try not to collide with other ports,
# and retry a max # times.
attempts = 0
- MAX_ATTEMPTS = 30
+ MAX_ATTEMPTS = 16
+ attempt_wait = 3
while attempts < MAX_ATTEMPTS:
server = self.launch_debug_monitor(attach_pid=attach_pid)
@@ -424,7 +425,8 @@ def connect_to_debug_monitor(self, attach_pid=None):
# And wait a random length of time before next attempt, to avoid
# collisions.
- time.sleep(random.randint(1, 5))
+ time.sleep(attempt_wait)
+ attempt_wait *= 1.2
# Now grab a new port number.
self.port = self.get_next_port()
More information about the lldb-commits
mailing list