@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 3ef74cde5d
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 8, 05:00 UTC

[CI][Tracing] Fix race condition by adding server readiness check (#34364)

Attempt to resolve #34284: "Metrics Tracing (2GPU)" fails with a segmentation fault. Signed-off-by: emricksini-h <emrick.birivoutin@hcompany.ai>

emricksini-h committed Feb 16, 2026 at 13:57 UTC 3ef74cde5d253333e993ea26931956962b6f70db
1 file changed +23
tests/tracing/conftest.py
+23
@@ -107,6 +107,22 @@ class FakeTraceService(TraceServiceServicer):
107 self.evt.clear()
108
109
110 +def _wait_for_server_ready(address: str, timeout: float = 5.0) -> bool:
111 + """Wait for the gRPC server to be ready to accept connections."""
112 + import socket
113 + import time
114 +
115 + host, port = address.rsplit(":", 1)
116 + deadline = time.monotonic() + timeout
117 + while time.monotonic() < deadline:
118 + try:
119 + with socket.create_connection((host, int(port)), timeout=0.5):
120 + return True
121 + except (OSError, ConnectionRefusedError):
122 + time.sleep(0.1)
123 + return False
124 +
125 +
126 @pytest.fixture
127 def trace_service() -> Generator[FakeTraceService, None, None]:
128 """Fixture to set up a fake gRPC trace service."""
@@ -116,6 +132,13 @@ def trace_service() -> Generator[FakeTraceService, None, None]:
132 server.add_insecure_port(FAKE_TRACE_SERVER_ADDRESS)
133 server.start()
134
135 + # Wait for the server to be ready to accept connections
136 + if not _wait_for_server_ready(FAKE_TRACE_SERVER_ADDRESS):
137 + server.stop(grace=None)
138 + raise RuntimeError(
139 + f"Fake trace server failed to start on {FAKE_TRACE_SERVER_ADDRESS}"
140 + )
141 +
142 yield service
143
144 server.stop(grace=None)