Skip to content

map AWS_IO_SOCKET_TIMEOUT to java's SocketTimeoutException #5943

@thomasjinlo

Description

@thomasjinlo

Describe the feature

Context

AwsCrtHttpClient returns a generic HttpException that requires looking at the error message to understand the type of error. This is different than ApacheHttpClient which returns specific exception subclassing IOException.

Problem

Use Case

We are upgrading from V1 to V2, and moving from ApacheHttpClient to CrtHttpClient and would like to keep the same functionality on retrying on connection and socket timeouts specifically.

Proposed Solution

On connection failures map AWS_IO_SOCKET_TIMEOUT (ETIMEDOUT) error code to SocketTimeoutException. We are already doing something similar with AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE to SSLHandshakeException.

https://github.com/aws/aws-sdk-java-v2/blob/master/http-clients/aws-crt-client/src/main/java/software/amazon/awssdk/http/crt/internal/CrtUtils.java#L58-L60

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

2.x

JDK version used

openjdk 17.0.14 2025-01-21 LTS

Operating System and version

AL2

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestA feature should be added or improved.p2This is a standard priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions