llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Raphael Isemann (Teemperor)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/195816.diff


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 
(+10-1) 


``````````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 c8acf67b23b99..0e9f187f9fe2b 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 stop 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(

``````````

</details>


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

Reply via email to