-
Notifications
You must be signed in to change notification settings - Fork 24
Add timeout error classification #590
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Add timeout error classification #590
Conversation
| if response.reason is not None: | ||
| message += f" - reason: {response.status}" | ||
|
|
||
| if response.status == 408: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why special case 408?
| "AWS_IO_SOCKET_TIMEOUT", | ||
| "AWS_IO_CHANNEL_ERROR_SOCKET_TIMEOUT", | ||
| "AWS_ERROR_HTTP_REQUEST_TIMEOUT", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are these coming from? Is this an exhaustive list for CRT errors?
| ) | ||
| except Exception as e: | ||
| error_info = self.transport.get_error_info(e) | ||
| if error_info.is_timeout_error: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based off the docstring for ClientTimeoutError, shouldn't we be checking the fault value? What if the fault is set to server?
Exception raised when a client-side timeout occurs.
| if isinstance(exception, AwsCrtError) and exception.name in timeout_indicators: | ||
| return ErrorInfo(is_timeout_error=True, fault="client") | ||
|
|
||
| return ErrorInfo(is_timeout_error=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why set fault="client" above and not here?
This pull request centralizes and clarifies timeout handling across the async client and transport layers by adding a transport-level error classification API and surfacing transport-detected timeouts as a dedicated ClientTimeoutError. Transports now return an ErrorInfo that indicates whether an exception represents a timeout and whether the fault is client- or server-side, and the core async client consults that information and raises ClientTimeoutError when appropriate so callers see a single, consistent exception for client-side timeouts.
ClientTransport implementations must now implement get_error_info(exception, **kwargs) and return an ErrorInfo indicating whether the exception is a timeout and whether the fault is client- or server-side. The break was required so the core async client can reliably classify transport errors and raise a single ClientTimeoutError for client-side timeouts. This information is necessary for handling errors as a part of retries.