@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 8ad6ff0037
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 5, 03:30 UTC

[Test] Fix @create_new_process_for_each_test("fork") in interactive shell pipeline (#29130)

Signed-off-by: Mark McLoughlin <markmc@redhat.com>

Mark McLoughlin committed Apr 15, 2026 at 17:22 UTC 8ad6ff0037e825e33bf31d902afcb12221ea39d1
1 file changed +8 -10
tests/utils.py
+8 -10
@@ -1261,9 +1261,6 @@ def fork_new_process_for_each_test(func: Callable[_P, None]) -> Callable[_P, Non
1261
1262 @functools.wraps(func)
1263 def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> None:
1264 - # Make the process the leader of its own process group
1265 - # to avoid sending SIGTERM to the parent process
1266 - os.setpgrp()
1264 from _pytest.outcomes import Skipped
1265
1266 # Create a unique temporary file to store exception info from child
@@ -1283,6 +1280,9 @@ def fork_new_process_for_each_test(func: Callable[_P, None]) -> Callable[_P, Non
1280 pid = os.fork()
1281 print(f"Fork a new process to run a test {pid}")
1282 if pid == 0:
1283 + # Make the child process the leader of its own process group
1284 + # to avoid sending SIGTERM to the parent process
1285 + os.setpgrp()
1286 # Parent process responsible for deleting, don't delete
1287 # in child.
1288 delete_after.pop_all()
@@ -1322,14 +1322,12 @@ def fork_new_process_for_each_test(func: Callable[_P, None]) -> Callable[_P, Non
1322 else:
1323 os._exit(0)
1324 else:
1325 - pgid = os.getpgid(pid)
1325 + # After setpgrp(), the child's pgid equals its pid
1326 + pgid = pid
1327 _pid, _exitcode = os.waitpid(pid, 0)
1327 - # ignore SIGTERM signal itself
1328 - old_signal_handler = signal.signal(signal.SIGTERM, signal.SIG_IGN)
1329 - # kill all child processes
1330 - os.killpg(pgid, signal.SIGTERM)
1331 - # restore the signal handler
1332 - signal.signal(signal.SIGTERM, old_signal_handler)
1328 + # kill all child processes - but they may already have exited cleanly
1329 + with contextlib.suppress(ProcessLookupError):
1330 + os.killpg(pgid, signal.SIGTERM)
1331 if _exitcode != 0:
1332 # Try to read the exception from the child process
1333 exc_info = {}