You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ratis.apache.org by wi...@apache.org on 2023/08/27 11:15:24 UTC
[ratis] branch master updated: RATIS-1876. NPE in GrpcLogAppender.resetClient. (#908)
This is an automated email from the ASF dual-hosted git repository.
williamsong pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git
The following commit(s) were added to refs/heads/master by this push:
new 670a4ee71 RATIS-1876. NPE in GrpcLogAppender.resetClient. (#908)
670a4ee71 is described below
commit 670a4ee71a48a74154044370c20cda5ff6932f6e
Author: Tsz-Wo Nicholas Sze <sz...@apache.org>
AuthorDate: Sun Aug 27 04:15:18 2023 -0700
RATIS-1876. NPE in GrpcLogAppender.resetClient. (#908)
---
.../src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
index d3bf28dee..63ef10a02 100644
--- a/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
+++ b/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java
@@ -123,8 +123,10 @@ public class GrpcLogAppender extends LogAppenderBase {
private void resetClient(AppendEntriesRequest request, boolean onError) {
try (AutoCloseableLock writeLock = lock.writeLock(caller, LOG::trace)) {
getClient().resetConnectBackoff();
- appendLogRequestObserver.stop();
- appendLogRequestObserver = null;
+ if (appendLogRequestObserver != null) {
+ appendLogRequestObserver.stop();
+ appendLogRequestObserver = null;
+ }
firstResponseReceived = false;
// clear the pending requests queue and reset the next index of follower
pendingRequests.clear();