[Bugfix] Use monotonic clocks for test server startup timeouts (#7628)

Signed-off-by: psv666 <2693925048@qq.com>
Co-authored-by: amy-why-3459 <wuhaiyan17@huawei.com>
This commit is contained in:
psv666andamy-why-3459 authored and GitHub committed 2026-09-19 21:25:14 +08:00
1 parent 470ec60848
commit f90c267ffb
2 files changed
+100 -6

No files matched your search

+10 -6
View File
@@ -38,6 +38,8 @@ from vllm_omni.outputs import OmniRequestOutput
logger = init_logger(__name__)
SERVER_STARTUP_TIMEOUT_S = 1200
PromptAudioInput = list[tuple[Any, int]] | tuple[Any, int] | None
PromptImageInput = list[Any] | Any | None
PromptVideoInput = list[Any] | Any | None
@@ -246,9 +248,10 @@ class OmniServer:
cwd=_omni_subprocess_cwd(),
)
max_wait = 1200
start_time = time.time()
while time.time() - start_time < max_wait:
max_wait = SERVER_STARTUP_TIMEOUT_S
# System clock corrections must not shorten or extend startup waits.
start_time = time.monotonic()
while time.monotonic() - start_time < max_wait:
ret = self.proc.poll()
if ret is not None:
raise RuntimeError(f"Server processes exited with code {ret} before becoming ready.")
@@ -550,9 +553,10 @@ class OmniServerStageCli(OmniServer):
for replica_id in range(self.stage_replica_counts.get(stage_id, 1)):
self._launch_stage(stage_id, headless=True, replica_id=replica_id)
max_wait = 1200
start_time = time.time()
while time.time() - start_time < max_wait:
max_wait = SERVER_STARTUP_TIMEOUT_S
# System clock corrections must not shorten or extend startup waits.
start_time = time.monotonic()
while time.monotonic() - start_time < max_wait:
self._ensure_stage_processes_alive()
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
sock.settimeout(1)