Fix worker poll hang: use client default timeout instead of disabling it#412
Open
manan164 wants to merge 1 commit into
Open
Fix worker poll hang: use client default timeout instead of disabling it#412manan164 wants to merge 1 commit into
manan164 wants to merge 1 commit into
Conversation
The REST clients passed timeout=None per request, which httpx interprets as "no timeout" (infinite) rather than "use the client default". On a half-open connection the poll then hangs forever and the worker silently stops polling until restarted (affects both sync and async workers). Pass httpx.USE_CLIENT_DEFAULT instead so the client's configured timeout applies. Adds a regression test that points each client at a half-open server and asserts the request fails on a bounded timeout instead of hanging. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
The REST clients passed
timeout=Noneper request, which httpx interprets as "no timeout" (infinite), not "use the client default". On a half-open connection (request sent, no response, socket never closed — e.g. an idle keep-alive flow silently dropped by an LB/NAT) the poll then hangs forever and the worker silently stops polling until restarted. This affects both sync (rest.py) and async (async_rest.py) workers.Fix
rest.pyandasync_rest.py: passhttpx.USE_CLIENT_DEFAULTinstead ofNoneso the client's configured timeout actually applies and a stuck read fails on a bounded timeout instead of hanging.tests/unit/api_client/test_poll_timeout.py: points each client at a half-open server and asserts the request raises on a bounded timeout instead of hanging.Notes / possible follow-ups
httpx.Timeout(120.0)); a shorter/ configurable read timeout for polls would make recovery faster than 120s.