[Fix] Wire the detokenizer soft watchdog into the multi-http-worker event loop (#31392)

This commit is contained in:
Liangsheng Yin
2026-07-15 21:55:46 -07:00
committed by GitHub
parent bc525dcf90
commit b871a509e6
@@ -381,12 +381,13 @@ class MultiHttpWorkerDetokenizerMixin:
def multi_http_worker_event_loop(self: DetokenizerManager): def multi_http_worker_event_loop(self: DetokenizerManager):
"""The event loop that handles requests, for multi multi-http-worker mode""" """The event loop that handles requests, for multi multi-http-worker mode"""
self.socket_mapping = SocketMapping() self.socket_mapping = SocketMapping()
# Watchdog wiring mirrors DetokenizerManager.event_loop: the watchdog is
# paused while waiting for input and fed once per processed message.
while True: while True:
with self.soft_watchdog.disable():
recv_obj = sock_recv(self.recv_from_scheduler) recv_obj = sock_recv(self.recv_from_scheduler)
output = self._request_dispatcher(recv_obj) output = self._request_dispatcher(recv_obj)
if output is None: if output is not None:
continue
# Fan out the output back to the originating tokenizer worker(s). # Fan out the output back to the originating tokenizer worker(s).
# In multi-detokenizer mode the upstream MultiDetokenizerRouter may # In multi-detokenizer mode the upstream MultiDetokenizerRouter may
# forward either batched or single requests, so handle both shapes. # forward either batched or single requests, so handle both shapes.
@@ -404,6 +405,7 @@ class MultiHttpWorkerDetokenizerMixin:
raise ValueError( raise ValueError(
f"multi_http_worker_event_loop got unexpected req type {type(recv_obj)}" f"multi_http_worker_event_loop got unexpected req type {type(recv_obj)}"
) )
self.soft_watchdog.feed()
class MultiTokenizerRouter: class MultiTokenizerRouter: