From cc440b10bdb9a397fc4dbd9ad45816bfbcd4041d Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Tue, 30 Sep 2025 09:43:14 -0700 Subject: [PATCH 1/3] Add retry for CRT HTTP client's socket closed error. --- .../Retries/DefaultRetryErrorInfoProvider.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift index 7e51218b3..307755796 100644 --- a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift +++ b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift @@ -12,6 +12,8 @@ import protocol SmithyRetriesAPI.RetryErrorInfoProvider import struct Foundation.TimeInterval import class Foundation.NSError import var Foundation.NSURLErrorDomain +import struct AwsCommonRuntimeKit.CRTError +import enum AwsCommonRuntimeKit.CommonRunTimeError public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable { /// Returns information used to determine how & if to retry an error. @@ -41,6 +43,11 @@ public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable { // NSURLErrorTimedOut = -1001 // "The request timed out." return .init(errorType: .transient, retryAfterHint: nil, isTimeout: true) + } else if let crtError = error as? CommonRunTimeError, + case .crtError(let crtErrorStruct) = crtError, + crtErrorStruct.code == 1051 { + // Retries CRTError(code: 1051, message: "socket is closed.", name: "AWS_IO_SOCKET_CLOSED")) + return .init(errorType: .transient, retryAfterHint: nil, isTimeout: false) } return nil } From b8b66dc4eee4a25f9c35b2d2300b0a46210126ca Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Wed, 1 Oct 2025 12:45:10 -0700 Subject: [PATCH 2/3] Add 1048 transient error also. --- .../Retries/DefaultRetryErrorInfoProvider.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift index 307755796..cfb8c6b30 100644 --- a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift +++ b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift @@ -48,6 +48,11 @@ public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable { crtErrorStruct.code == 1051 { // Retries CRTError(code: 1051, message: "socket is closed.", name: "AWS_IO_SOCKET_CLOSED")) return .init(errorType: .transient, retryAfterHint: nil, isTimeout: false) + } else if let crtError = error as? CommonRunTimeError, + case .crtError(let crtErrorStruct) = crtError, + crtErrorStruct.code == 1048 { + // Retries CRTError(code: 1048, message: "socket operation timed out.", name: "AWS_IO_SOCKET_TIMEOUT")) + return .init(errorType: .transient, retryAfterHint: nil, isTimeout: true) } return nil } From 11f7404b799324cf553a633917fe7c206c617bfe Mon Sep 17 00:00:00 2001 From: Sichan Yoo Date: Sat, 4 Oct 2025 11:52:19 -0700 Subject: [PATCH 3/3] Add 1067 CRT error code as retryable. --- .../Retries/DefaultRetryErrorInfoProvider.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift index cfb8c6b30..250adae58 100644 --- a/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift +++ b/Sources/ClientRuntime/Retries/DefaultRetryErrorInfoProvider.swift @@ -53,6 +53,11 @@ public enum DefaultRetryErrorInfoProvider: RetryErrorInfoProvider, Sendable { crtErrorStruct.code == 1048 { // Retries CRTError(code: 1048, message: "socket operation timed out.", name: "AWS_IO_SOCKET_TIMEOUT")) return .init(errorType: .transient, retryAfterHint: nil, isTimeout: true) + } else if let crtError = error as? CommonRunTimeError, + case .crtError(let crtErrorStruct) = crtError, + crtErrorStruct.code == 1067 { + // Retries CRTError(code: 1067, message: "Channel shutdown due to tls negotiation timeout", name: "AWS_IO_TLS_NEGOTIATION_TIMEOUT")) + return .init(errorType: .transient, retryAfterHint: nil, isTimeout: true) } return nil }