Fail fast on AWS sandbox STS endpoint timeout/connection failures#2965
Open
SanketMeghale wants to merge 1 commit intoNetflix:masterfrom
Open
Fail fast on AWS sandbox STS endpoint timeout/connection failures#2965SanketMeghale wants to merge 1 commit intoNetflix:masterfrom
SanketMeghale wants to merge 1 commit intoNetflix:masterfrom
Conversation
Contributor
Greptile SummaryThis PR adds fail-fast behavior to the AWS sandbox STS credential fetch path in
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant Boto3ClientProvider
participant STS as Sandbox STS Endpoint
participant Cache as cached_aws_sandbox_creds
Caller->>Boto3ClientProvider: get_client("s3")
Boto3ClientProvider->>Cache: Check cache
alt Cache hit
Cache-->>Boto3ClientProvider: Return cached creds
else Cache miss
Boto3ClientProvider->>STS: requests.get(url, timeout=(5, 30))
alt Success
STS-->>Boto3ClientProvider: 200 + JSON creds
Boto3ClientProvider->>Cache: Store creds
else Timeout (connect >5s or read >30s)
STS-->>Boto3ClientProvider: Timeout
Boto3ClientProvider-->>Caller: MetaflowException (timeout message)
else Connection Error
STS-->>Boto3ClientProvider: ConnectionError
Boto3ClientProvider-->>Caller: MetaflowException (connection message)
else HTTP Error
STS-->>Boto3ClientProvider: 4xx/5xx
Boto3ClientProvider-->>Caller: MetaflowException (HTTP error)
end
end
Boto3ClientProvider->>Caller: boto3 client
Last reviewed commit: 887d2b5 |
10 tasks
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.
PR Type
Summary
Fail fast when AWS sandbox STS endpoint is unreachable by adding explicit request timeout and error wrapping in
Boto3ClientProvider.get_client.Issue
Fixes #2924
Reproduction
Runtime: local
Commands to run:
Where evidence shows up: parent console traceback
Before (error / log snippet)
After (evidence that fix works)
Root Cause
In sandbox mode, STS token fetch used
requests.getwithout an explicit timeout. Unreachable/misconfigured endpoints relied on OS/network timeout behavior, causing long hangs. Also, timeout and connection failures were not wrapped intoMetaflowException, yielding less actionable failures.Why This Fix Is Correct
The patch restores predictable fail-fast behavior by setting an explicit
(connect, read)timeout tuple and wrapping timeout/connection failures asMetaflowExceptionwith endpoint context. Scope is limited to sandbox credential fetch path and does not alter non-sandbox AWS client behavior.Failure Modes Considered
ConnectionErrorand wrapped with actionable message.Tests
Added
test/unit/test_aws_client.pywith focused coverage for:Non-Goals
AI Tool Usage
Used AI tooling for drafting and iterating patch/test scaffolding. All changes were reviewed, adjusted, and validated by me before submission.