|
2 | 2 | # SPDX-License-Identifier: Apache-2.0 |
3 | 3 |
|
4 | 4 | import multiprocessing as mp |
| 5 | +import sys |
5 | 6 |
|
6 | 7 | import pytest |
7 | 8 | from helpers.buffers import PatternGen |
@@ -39,6 +40,15 @@ def test_main(self, ipc_device, ipc_memory_resource): |
39 | 40 |
|
40 | 41 | # Wait for the child process. |
41 | 42 | process.join(timeout=CHILD_TIMEOUT_SEC) |
| 43 | + if process.is_alive(): |
| 44 | + print( |
| 45 | + f"[WARN] child process {process.pid} still alive after " |
| 46 | + f"{CHILD_TIMEOUT_SEC}s — sending SIGKILL " |
| 47 | + f"(likely compute-sanitizer IPC deadlock, see issue #2004)", |
| 48 | + file=sys.stderr, |
| 49 | + ) |
| 50 | + process.kill() |
| 51 | + process.join() |
42 | 52 | assert process.exitcode == 0 |
43 | 53 |
|
44 | 54 | # Verify that the buffer was modified. |
@@ -82,6 +92,16 @@ def test_main(self, ipc_device, ipc_memory_resource): |
82 | 92 | # Wait for the child processes. |
83 | 93 | p1.join(timeout=CHILD_TIMEOUT_SEC) |
84 | 94 | p2.join(timeout=CHILD_TIMEOUT_SEC) |
| 95 | + for p in (p1, p2): |
| 96 | + if p.is_alive(): |
| 97 | + print( |
| 98 | + f"[WARN] child process {p.pid} still alive after " |
| 99 | + f"{CHILD_TIMEOUT_SEC}s — sending SIGKILL " |
| 100 | + f"(likely compute-sanitizer IPC deadlock, see issue #2004)", |
| 101 | + file=sys.stderr, |
| 102 | + ) |
| 103 | + p.kill() |
| 104 | + p.join() |
85 | 105 | assert p1.exitcode == 0 |
86 | 106 | assert p2.exitcode == 0 |
87 | 107 |
|
@@ -135,6 +155,16 @@ def test_main(self, ipc_device, ipc_memory_resource): |
135 | 155 | # Wait for children. |
136 | 156 | p1.join(timeout=CHILD_TIMEOUT_SEC) |
137 | 157 | p2.join(timeout=CHILD_TIMEOUT_SEC) |
| 158 | + for p in (p1, p2): |
| 159 | + if p.is_alive(): |
| 160 | + print( |
| 161 | + f"[WARN] child process {p.pid} still alive after " |
| 162 | + f"{CHILD_TIMEOUT_SEC}s — sending SIGKILL " |
| 163 | + f"(likely compute-sanitizer IPC deadlock, see issue #2004)", |
| 164 | + file=sys.stderr, |
| 165 | + ) |
| 166 | + p.kill() |
| 167 | + p.join() |
138 | 168 | assert p1.exitcode == 0 |
139 | 169 | assert p2.exitcode == 0 |
140 | 170 |
|
@@ -185,6 +215,16 @@ def test_main(self, ipc_device, ipc_memory_resource): |
185 | 215 | # Wait for children. |
186 | 216 | p1.join(timeout=CHILD_TIMEOUT_SEC) |
187 | 217 | p2.join(timeout=CHILD_TIMEOUT_SEC) |
| 218 | + for p in (p1, p2): |
| 219 | + if p.is_alive(): |
| 220 | + print( |
| 221 | + f"[WARN] child process {p.pid} still alive after " |
| 222 | + f"{CHILD_TIMEOUT_SEC}s — sending SIGKILL " |
| 223 | + f"(likely compute-sanitizer IPC deadlock, see issue #2004)", |
| 224 | + file=sys.stderr, |
| 225 | + ) |
| 226 | + p.kill() |
| 227 | + p.join() |
188 | 228 | assert p1.exitcode == 0 |
189 | 229 | assert p2.exitcode == 0 |
190 | 230 |
|
|
0 commit comments