Skip to content

[MLI-8206] Set an explicit, configurable timeout on the sync forwarder - #864

Closed
lorenzo-norcini-scale wants to merge 2 commits into
mainfrom
mli-8206-sync-forwarder-timeout
Closed

[MLI-8206] Set an explicit, configurable timeout on the sync forwarder#864
lorenzo-norcini-scale wants to merge 2 commits into
mainfrom
mli-8206-sync-forwarder-timeout

Conversation

@lorenzo-norcini-scale

@lorenzo-norcini-scale lorenzo-norcini-scale commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Problem

The sync http-forwarder posts to the local inference server without an explicit aiohttp timeout, so aiohttp's client default of total=300s applies. Non-streaming generations that take longer than 5 minutes are cut off with a 500 (TimeoutError in forwarding.py:forward) while the inference server keeps computing the response. Observed on the qwen3-5-9b model-zoo endpoint (MLI-8206).

Change

  • Add a timeout_seconds field to Forwarder and LoadForwarder, passed as aiohttp.ClientTimeout(total=...) on the forward request.
  • Default is 3600s, overridable per deployment via the existing forwarder config path (forwarder.sync.timeout_seconds).
  • The sync __call__ path (requests-based) and the streaming forwarder are unchanged.

Testing

  • New parametrized unit test covers the default and an override propagating through LoadForwarder.load.
  • tests/unit/inference: 53 passed, 2 skipped locally.
  • black / isort / ruff / mypy clean on changed files.

🤖 Generated with Claude Code

Greptile Summary

The PR adds a configurable one-hour default timeout to asynchronous non-streaming forward requests and validates overrides during forwarder loading.

  • Passes the configured timeout to aiohttp.ClientTimeout.
  • Rejects nonnumeric, Boolean, non-finite, zero, and negative timeout values at startup.
  • Tests default and overridden propagation plus invalid configurations.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
model-engine/model_engine_server/inference/forwarding/forwarding.py Adds and validates the configurable sync-forwarding timeout before applying it to asynchronous HTTP requests.
model-engine/tests/unit/inference/test_forwarding.py Covers default and overridden timeout propagation and rejects representative invalid values.

Reviews (2): Last reviewed commit: "Validate timeout_seconds at forwarder lo..." | Re-trigger Greptile

The sync http-forwarder posts to the local inference server without an
explicit aiohttp timeout, so the client default of total=300s applies.
Non-streaming generations that take longer than 5 minutes are cut off
with a 500 while the inference server keeps computing the response.

Add a timeout_seconds field to Forwarder and LoadForwarder (default
3600s), overridable per deployment via forwarder.sync.timeout_seconds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread model-engine/model_engine_server/inference/forwarding/forwarding.py
Reject zero, negative, non-finite, and non-numeric values when the
forwarder config is loaded, instead of letting them reach
aiohttp.ClientTimeout at request time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@lorenzo-norcini-scale

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated incident-hardening PR: see the PR referencing this one.

@lorenzo-norcini-scale

Copy link
Copy Markdown
Collaborator Author

Superseded by #868.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants