[BugFix] Add sleep to fix tight loop and release GIL (#29476)

Signed-off-by: alec-flowers <aflowers@nvidia.com>
Signed-off-by: Alec <35311602+alec-flowers@users.noreply.github.com>
Co-authored-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
Alec 2025-12-18 09:52:55 -08:00 committed by GitHub
parent 500f26e6d3
commit 62be3670cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -923,6 +923,13 @@ class EngineCoreProc(EngineCore):
# Post-step hook.
self.post_step(model_executed)
# If no model execution happened but there are waiting requests
# (e.g., WAITING_FOR_REMOTE_KVS), yield the GIL briefly to allow
# background threads (like NIXL handshake) to make progress.
# Without this, the tight polling loop can starve background threads.
if not model_executed and self.scheduler.has_unfinished_requests():
time.sleep(0.001)
return model_executed
def _handle_client_request(