[Lldb-commits] [lldb] Use a fallback interval strategy for the task_for_pid request. (PR #217425)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 19 11:31:59 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: jimingham
<details>
<summary>Changes</summary>
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.
The fallback I chose does:
0: 0.01
1: 0.02
2: 0.04
3: 0.07
4: 0.11
5: 0.16
6: 0.22
7: 0.29
8: 0.37
9: 0.46
which seems reasonable to me. At worst this will wait about a second, which is still below our test launch timeouts.
---
Full diff: https://github.com/llvm/llvm-project/pull/217425.diff
1 Files Affected:
- (modified) lldb/tools/debugserver/source/MacOSX/MachTask.mm (+8-1)
``````````diff
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;
``````````
</details>
https://github.com/llvm/llvm-project/pull/217425
More information about the lldb-commits
mailing list