You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Tsz-wo Sze (Jira)" <ji...@apache.org> on 2023/07/04 11:40:00 UTC
[jira] [Updated] (RATIS-1854) Remove useless error logs when closing the ratisclient writing thread
[ https://issues.apache.org/jira/browse/RATIS-1854?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tsz-wo Sze updated RATIS-1854:
------------------------------
Component/s: gRPC
Issue Type: Improvement (was: Bug)
> 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
> 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)