[llvm] [Dexter] Replace DAP "initialized" timeout with a warning (PR #174198)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 6 04:18:53 PST 2026


https://github.com/SLTozer updated https://github.com/llvm/llvm-project/pull/174198

>From 3c5446ab6b4a4283600fdf0d396824e3d960c322 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Fri, 2 Jan 2026 10:41:37 +0000
Subject: [PATCH 1/3] [Dexter] Replace DAP "initialized" timeout with a warning

Fixes https://github.com/llvm/llvm-project/issues/172893.

In the issue reported above there, it appears that LLDB is hitting a 3s
timeout as part of some CI tests; this patch attempts to fix the issue by
replacing the 3s timeout with a warning printed after 10s.
---
 .../debuginfo-tests/dexter/dex/debugger/DAP.py  | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
index b75fe18d8ba0a..d94c5c70a44b1 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
@@ -775,16 +775,17 @@ def launch(self, cmdline):
 
         # Wait for the initialized event; for LLDB, this will be sent after the launch request has been processed;
         # for other debuggers, it will have been sent some time after the initialize response was sent.
-        # NB: In all current cases this timeout is never hit because the initialized event is received almost
-        # immediately after either the initialize response or the launch request/response; if this starts being hit, we
-        # probably need to parameterize this.
-        initialize_timeout = Timeout(3)
+        # FIXME: It may be possible that Dexter should do something about this timeout, but as we don't know whether
+        # some debuggers/inputs may reasonably trigger the timeout, leave it as a warning for now.
+        initialize_timeout = Timeout(10)
         while not self._debugger_state.initialized:
-            if initialize_timeout.timed_out():
-                raise TimeoutError(
-                    f"Timed out while waiting for initialized event from DAP"
+            if initialize_timeout and initialize_timeout.timed_out():
+                self.context.logger.warning(
+                    "Waiting for 'initialized' event for more than 10 seconds, debugger may be hanging."
                 )
-            time.sleep(0.001)
+                # Only trigger the warning once.
+                initialize_timeout = None
+            time.sleep(0.01)
 
         # Set breakpoints after receiving launch response but before configurationDone.
         self._flush_breakpoints()

>From d9b63d364b53ce6b7bdc22dcb0fcea7293e610ac Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Tue, 6 Jan 2026 11:38:06 +0000
Subject: [PATCH 2/3] Re-add timeout at extended duration

---
 .../debuginfo-tests/dexter/dex/debugger/DAP.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
index d94c5c70a44b1..3e666cf044d2d 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
@@ -775,16 +775,14 @@ def launch(self, cmdline):
 
         # Wait for the initialized event; for LLDB, this will be sent after the launch request has been processed;
         # for other debuggers, it will have been sent some time after the initialize response was sent.
-        # FIXME: It may be possible that Dexter should do something about this timeout, but as we don't know whether
-        # some debuggers/inputs may reasonably trigger the timeout, leave it as a warning for now.
-        initialize_timeout = Timeout(10)
-        while not self._debugger_state.initialized:
-            if initialize_timeout and initialize_timeout.timed_out():
-                self.context.logger.warning(
-                    "Waiting for 'initialized' event for more than 10 seconds, debugger may be hanging."
-                )
-                # Only trigger the warning once.
-                initialize_timeout = None
+        # NB: In all currently known cases this timeout is never hit because the initialized event is usually received
+        # almost immediately after either the initialize response or the launch request/response, and otherwise this
+        # timeout is long enough for any internal debugger timeout to be hit, and so if this gets hit it probably means
+        # the debugger is hanging.
+        initialize_timeout = Timeout(60)
+        while self._proc.poll() is None and not self._debugger_state.initialized:
+            if initialize_timeout.timed_out():
+                raise TimeoutError("Timed out while waiting for initialized event from DAP")
             time.sleep(0.01)
 
         # Set breakpoints after receiving launch response but before configurationDone.

>From e660a30448e135718a03e81fcba1d18fd7ee261c Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Tue, 6 Jan 2026 12:18:38 +0000
Subject: [PATCH 3/3] darker

---
 .../debuginfo-tests/dexter/dex/debugger/DAP.py                | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
index 3e666cf044d2d..c09950b91b273 100644
--- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
+++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py
@@ -782,7 +782,9 @@ def launch(self, cmdline):
         initialize_timeout = Timeout(60)
         while self._proc.poll() is None and not self._debugger_state.initialized:
             if initialize_timeout.timed_out():
-                raise TimeoutError("Timed out while waiting for initialized event from DAP")
+                raise TimeoutError(
+                    "Timed out while waiting for initialized event from DAP"
+                )
             time.sleep(0.01)
 
         # Set breakpoints after receiving launch response but before configurationDone.



More information about the llvm-commits mailing list