Uploaded image for project: 'Ratis'
  1. Ratis
  2. RATIS-1854

Remove useless error logs when closing the ratisclient writing thread

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.5.1
    • 3.0.0
    • client, gRPC
    • None

    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

        Issue Links

          Activity

            People

              tanxinyu Xinyu Tan
              tanxinyu Xinyu Tan
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h