From 50e686094c316560864c30a0295b3ed3f655c765 Mon Sep 17 00:00:00 2001 From: Mattie Fu Date: Tue, 5 Oct 2021 12:03:53 -0400 Subject: [PATCH] fix: fix typo in rst stream message (#1029) * fix: fix typo in rst stream message * filter all errors with "rst stream" in it --- .../v2/stub/readrows/ReadRowsConvertExceptionCallable.java | 5 +++-- .../bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsConvertExceptionCallable.java b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsConvertExceptionCallable.java index 69dd2b5b8..0c58f6644 100644 --- a/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsConvertExceptionCallable.java +++ b/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsConvertExceptionCallable.java @@ -77,8 +77,9 @@ public void onComplete() { private Throwable convertException(Throwable t) { // Long lived connections sometimes are disconnected via an RST frame. This error is // transient and should be retried. - if (t instanceof InternalException) { - if (t.getMessage() != null && t.getMessage().contains("Received Rst stream")) { + if (t instanceof InternalException && t.getMessage() != null) { + String error = t.getMessage().toLowerCase(); + if (error.contains("rst_stream") || error.contains("rst stream")) { return new InternalException(t, ((InternalException) t).getStatusCode(), true); } } diff --git a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java index 178dab1f1..54a3af5cf 100644 --- a/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java +++ b/google-cloud-bigtable/src/test/java/com/google/cloud/bigtable/data/v2/stub/readrows/ReadRowsRetryTest.java @@ -270,7 +270,7 @@ public void retryRstStreamExceptionTest() { new InternalException( new StatusRuntimeException( Status.INTERNAL.withDescription( - "HTTP/2 error code: INTERNAL_ERROR\nReceived Rst stream")), + "INTERNAL: HTTP/2 error code: INTERNAL_ERROR\nReceived Rst Stream")), GrpcStatusCode.of(Code.INTERNAL), false); service.expectations.add(