Xinyu Tan created RATIS-1854:
--------------------------------
Summary: Remove useless error logs when closing the ratisclient
writing thread
Key: RATIS-1854
URL: https://issues.apache.org/jira/browse/RATIS-1854
Project: Ratis
Issue Type: Bug
Components: client
Affects Versions: 2.5.1
Reporter: Xinyu Tan
Assignee: Xinyu Tan
Attachments: image-2023-07-04-11-25-26-265.png
Recently we observed that when stopping a ratis-based service, we might
interupt the thread that was performing ratis writes, at which point it might
log an exception.
!image-2023-07-04-11-25-26-265.png!
After observing the logic here, we think that for the shutdownManagedChannel
function, when we detect InterruptedException, we can continue to set the
status bit of the current thread to continue back up, because there is no
significant exception to the cluster state at this time. Typing an error log
may be confusing.
I simply repaired a patch, which can avoid such problems again. Would you
please check if there is any problem. [~szetszwo]
{code:java}
diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcUtil.java
b/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcUtil.java
index 23e8a826..8997c6de 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcUtil.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/GrpcUtil.java
@@ -222,6 +222,8 @@ public interface GrpcUtil {
if (!managedChannel.awaitTermination(3, TimeUnit.SECONDS)) {
LOG.warn("Timed out gracefully shutting down connection: {}. ",
managedChannel);
}
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
} catch (Exception e) {
LOG.error("Unexpected exception while waiting for channel
termination", e);
}
@@ -234,6 +236,8 @@ public interface GrpcUtil {
if (!managedChannel.awaitTermination(2, TimeUnit.SECONDS)) {
LOG.warn("Timed out forcefully shutting down connection: {}. ",
managedChannel);
}
+ }catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
} catch (Exception e) {
LOG.error("Unexpected exception while waiting for channel
termination", e);
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)