https://github.com/jimingham updated 
https://github.com/llvm/llvm-project/pull/217425

>From e2d601222de5feee1acea351ce17e46e79e0a91c Mon Sep 17 00:00:00 2001
From: Jim Ingham <[email protected]>
Date: Wed, 19 Aug 2026 11:22:37 -0700
Subject: [PATCH] Use a fallback interval strategy for the task_for_pid
 request.

We've seen cases on heavily loaded bots where task_for_pid requests
get denied because the authentication system is overloaded.  Use an
increasing timeout to avoid piling on when this is happening.
---
 lldb/tools/debugserver/source/MacOSX/MachTask.mm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lldb/tools/debugserver/source/MacOSX/MachTask.mm 
b/lldb/tools/debugserver/source/MacOSX/MachTask.mm
index 22ad0c407de42..c7b589abaa5e4 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachTask.mm
+++ b/lldb/tools/debugserver/source/MacOSX/MachTask.mm
@@ -529,6 +529,8 @@ static void get_threads_profile_data(DNBProfileDataScanType 
scanType,
     DNBError err;
     mach_port_t task_self = mach_task_self();
     task_t task = TASK_NULL;
+    uint32_t interval = k_usec_delay;
+
     for (uint32_t i = 0; i < k_num_retries; i++) {
       DNBLog("[LaunchAttach] (%d) about to task_for_pid(%d)", getpid(), pid);
       err = ::task_for_pid(task_self, pid, &task);
@@ -556,7 +558,12 @@ static void 
get_threads_profile_data(DNBProfileDataScanType scanType,
       }
 
       // Sleep a bit and try again
-      ::usleep(k_usec_delay);
+      // Use an increasing interval so that if there's a short term traffic
+      // jam, we skip past rather than exacerbating it.  We see this sequence
+      // timing out occasionally on heavily loaded bots, seemingly because the
+      // syspolicyd isn't keeping up.
+      interval += k_usec_delay * i;
+      ::usleep(interval);
     }
   }
   return TASK_NULL;

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to