https://github.com/Teemperor updated 
https://github.com/llvm/llvm-project/pull/195816

>From ed58efd876782e82c52683bf867c8da8ce06656d Mon Sep 17 00:00:00 2001
From: Raphael Isemann <[email protected]>
Date: Fri, 1 May 2026 10:41:43 +0100
Subject: [PATCH] [lldb][test] Move DAP processes to own group to avoid random
 SIGHUPs

On macOS, LLDB's test suite randomly receives SIGHUP signals that stop
the test suite early. The source of these SIGHUP's seems to be
a bug in the kernel (most likely job control).

The exact steps for reproducing this are not clear, but I have a set
of three tests of which two need to run concurrently for this to
trigger:

* TestDAP_runInTerminal
* TestDAP_launch_io_integratedTerminal
* TestDAP_launch_stdio_redirection_and_console

I was also running UBSan on this build which may or may not be
necessary to make this random failure more persistent.

When these tests run, macOS job control will send SIGHUP to the
process group of the spawned subprocesses in that test. As LIT is in
the same process group, it also receives the SIGHUP and shuts down.

This patch just uses Python's API for forcing the spawned subprocess
to its own process group. This won't stop the SIGHUP and only prevents
it from reaching LIT.

The SIGHUP itself doesn't seem to affect the DAP test itself. My theory
here is that the SIGHUP is received during test shutdown (or after it
was shut down), so that's why it doesn't cause any visible failures
in any of the tests.
---
 .../lldbsuite/test/tools/lldb-dap/dap_server.py       | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

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 c8acf67b23b99..9d0f50866d3fb 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
@@ -512,7 +512,16 @@ def _handle_reverse_request(self, request: Request) -> 
None:
             env_dict = os.environ | arguments.get("env", {})
             env = [f"{k}={v}" for k, v in env_dict.items()]
             self.reverse_process = self.spawn_helper(
-                exe, args, env, stdout=subprocess.PIPE, stderr=subprocess.PIPE
+                exe, args, env, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+                # This works around a bug in the macOS job control code where
+                # a supurious SIGHUP is sent to the the process group of our
+                # spawned subprocess when it is shutting down.
+                # While this SIGHUP doesn't cause any issues for our 
subprocess,
+                # it does reach the LIT process and stops the test suite run
+                # early.
+                # This parameter forces the spawned process into a new process
+                # group which prevents the supurious SIGHUP from reaching LIT.
+                start_new_session=True
             )
             body = {"processId": self.reverse_process.pid}
             self.send_packet(

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

Reply via email to