[Lldb-commits] [lldb] [lldb-dap] Make the DAP server resilient against broken pipes (PR #133791)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Mar 31 13:23:05 PDT 2025
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/133791
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 swooping 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)
>From 88bd875f9f294a055dc37f52a6476fc661742fae Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Mon, 31 Mar 2025 13:20:03 -0700
Subject: [PATCH] [lldb-dap] Make the DAP server resilient against broken pipes
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 swooping 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()
```
---
.../Python/lldbsuite/test/tools/lldb-dap/dap_server.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
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 = []
More information about the lldb-commits
mailing list