Skip to content

Commit 8e20b1c

Browse files
committed
Retry IOException: Error writing request body to server to fix the
intermittent failure when uploading to gcs
1 parent 71637ce commit 8e20b1c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,13 @@ public static boolean isRetryable(Integer code, String reason, boolean idempoten
254254

255255
@InternalApi
256256
public static boolean isRetryable(boolean idempotent, IOException exception) {
257-
boolean exceptionIsRetryable = exception instanceof SocketTimeoutException
258-
|| exception instanceof SocketException
259-
|| (exception instanceof SSLHandshakeException
260-
&& !(exception.getCause() instanceof CertificateException))
261-
|| "insufficient data written".equals(exception.getMessage());
257+
boolean exceptionIsRetryable =
258+
exception instanceof SocketTimeoutException
259+
|| exception instanceof SocketException
260+
|| (exception instanceof SSLHandshakeException
261+
&& !(exception.getCause() instanceof CertificateException))
262+
|| "insufficient data written".equals(exception.getMessage())
263+
|| "Error writing request body to server".equals(exception.getMessage());
262264
return idempotent && exceptionIsRetryable;
263265
}
264266

0 commit comments

Comments
 (0)