From 8e20b1c41e1ae99c4761f716c1ab4dc0f9fbf5e0 Mon Sep 17 00:00:00 2001 From: Hanzhen Yi Date: Mon, 9 Jul 2018 11:11:11 -0700 Subject: [PATCH] Retry IOException: Error writing request body to server to fix the intermittent failure when uploading to gcs --- .../java/com/google/cloud/BaseServiceException.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java b/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java index a0058a2e3f2b..565ae614f3a6 100644 --- a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java +++ b/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/BaseServiceException.java @@ -254,11 +254,13 @@ public static boolean isRetryable(Integer code, String reason, boolean idempoten @InternalApi public static boolean isRetryable(boolean idempotent, IOException exception) { - boolean exceptionIsRetryable = exception instanceof SocketTimeoutException - || exception instanceof SocketException - || (exception instanceof SSLHandshakeException - && !(exception.getCause() instanceof CertificateException)) - || "insufficient data written".equals(exception.getMessage()); + boolean exceptionIsRetryable = + exception instanceof SocketTimeoutException + || exception instanceof SocketException + || (exception instanceof SSLHandshakeException + && !(exception.getCause() instanceof CertificateException)) + || "insufficient data written".equals(exception.getMessage()) + || "Error writing request body to server".equals(exception.getMessage()); return idempotent && exceptionIsRetryable; }