Repository navigation
fix(client): cap readiness probes by remaining wait budget - #5745
Open
linjiaye929 wants to merge 1 commit into
Open
linjiaye929 wants to merge 1 commit into
linjiaye929 wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
What does this PR address?
Cap readiness-probe HTTP timeouts by the remaining
server_ready_timeoutbudget in both public HTTP clients, while preserving a shorter configured request timeout. Reject a successful readiness response if it arrives after the monotonic deadline.Previously the loop checked elapsed time only before
GET /readyz, whose timeout remained the ordinary request timeout (30 seconds by default). Withserver_ready_timeout=1, a synthetic server delaying/readyzfor 2 seconds could return 200 and the client would accept it and fetch the schema after the readiness budget had elapsed.The change is local to the two readiness loops.
Nonestill falls back to the request timeout; nonpositive initialization timeouts still skip readiness waiting, while direct nonpositive waits still raiseServiceUnavailable. Ordinary endpoint timeouts and the exception message are unchanged.Limit: HTTPX applies timeouts to individual request phases / inactivity. This caps each probe's phase timeout and rejects late success; it does not introduce a hard end-to-end deadline across all transport phases or client initialization.
Validation
Python 3.12.14, pytest 7.4.0 / pytest-asyncio 0.21.1 as declared by the project:
MockTransport. MockTransport itself does not enforce timeouts; the cases inspect budgets, retries and late-response decisions.pre-commit run --all-files: passed; the two Buf hooks had no applicable files. The unchanged base passes the same checks.git diff --checkpass. Python 3.9 grammar was checked, but other Python runtimes, the full test suite and deployment/load tests were not run.Before submitting
AI assistance was used for analysis, implementation and the stated automated checks. No human approval or hosted CI success is claimed.
Hosted checks
At head
374caa045d46f4def16355c875db96dc72a76015, pre-commit.ci succeeded. GitHub ActionsCI,code-quality, andCodeQLare completed withaction_required, each with zero jobs; there are zero check runs. Those Actions have not executed their tests/scans. This is not a claim that all hosted CI passed.