[Lldb-commits] [lldb] [lldb-dap] Make the DAP server resilient against broken pipes (PR #133791)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 31 13:23:43 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Jonas Devlieghere (JDevlieghere)
<details>
<summary>Changes</summary>
This makes the DAP test server resilient against broken pipes. I'm not sure what is causing the broken pipe, but IIRC this isn't the first time we've seen an issues related to that. I worry about sweeping it under the rug, but on the other hand having the test suite hangup isn't great either.
Based this on https://bugs.python.org/issue21619:
> The best way to clean up a subprocess that I have come up with to
> close the pipe(s) and call wait() in two separate steps, such as:
```
try:
proc.stdin.close()
except BrokenPipeError:
pass
proc.wait()
```
Fixes #<!-- -->133782 (or rather: works around it)
---
Full diff: https://github.com/llvm/llvm-project/pull/133791.diff
1 Files Affected:
- (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (+4-2)
``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
index 01ef4b68f2653..57907b1d2f19b 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py
@@ -1174,8 +1174,10 @@ def request_testGetTargetBreakpoints(self):
return self.send_recv(command_dict)
def terminate(self):
- self.send.close()
- # self.recv.close()
+ try:
+ self.send.close()
+ except BrokenPipeError:
+ pass
def request_setInstructionBreakpoints(self, memory_reference=[]):
breakpoints = []
``````````
</details>
https://github.com/llvm/llvm-project/pull/133791
More information about the lldb-commits
mailing list