Description
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.
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
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); }
Attachments
Attachments
Issue Links
- links to