[
https://issues.apache.org/jira/browse/RATIS-1854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tsz-wo Sze resolved RATIS-1854.
-------------------------------
Fix Version/s: 3.0.0
Resolution: Fixed
The pull request is now merged. Thanks, [~tanxinyu]!
> 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: Improvement
> Components: client, gRPC
> Affects Versions: 2.5.1
> Reporter: Xinyu Tan
> Assignee: Xinyu Tan
> Priority: Major
> Fix For: 3.0.0
>
> Attachments: image-2023-07-04-11-25-26-265.png
>
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> 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)