This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git


The following commit(s) were added to refs/heads/main by this push:
     new 3e71ae4cd fix: reconnection race condition (#290)
3e71ae4cd is described below

commit 3e71ae4cdd0105c21a0fd43f7c7b18f8b0059c40
Author: Brandon Fergerson <[email protected]>
AuthorDate: Mon Aug 8 18:42:11 2022 +0400

    fix: reconnection race condition (#290)
---
 CHANGES.md                                                           | 5 +++--
 .../apache/skywalking/apm/agent/core/remote/GRPCChannelManager.java  | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 8ed63a674..418b7918b 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -4,9 +4,9 @@ Release Notes.
 
 8.12.0
 ------------------
-* Fix `Shenyu plugin`'s NPE in reading read trace ID when IgnoredTracerContext 
is used in the context.
+* Fix `Shenyu plugin`'s NPE in reading trace ID when IgnoredTracerContext is 
used in the context.
 * Update witness class in elasticsearch-6.x-plugin, avoid throw NPE.
-* Fix `onHalfClose` using span operation name `/Request/onComplete` instead of 
the worng name `/Request/onHalfClose`.
+* Fix `onHalfClose` using span operation name `/Request/onComplete` instead of 
the wrong name `/Request/onHalfClose`.
 * Add plugin to support RESTeasy 4.x.
 * Add plugin to support hutool-http 5.x.
 * Add plugin to support Tomcat 10.x.
@@ -14,6 +14,7 @@ Release Notes.
 * Upgrade byte-buddy to 1.12.13, and adopt byte-buddy APIs changes.
 * Upgrade gson to 2.8.9.
 * Upgrade netty-codec-http2 to 4.1.79.Final.
+* Fix race condition causing agent to not reconnect after network error
 
 #### Documentation
 
diff --git 
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/GRPCChannelManager.java
 
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/GRPCChannelManager.java
index 2d2308809..9744398fd 100755
--- 
a/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/GRPCChannelManager.java
+++ 
b/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/remote/GRPCChannelManager.java
@@ -146,16 +146,16 @@ public class GRPCChannelManager implements BootService, 
Runnable {
                                                     .addChannelDecorator(new 
AgentIDDecorator())
                                                     .addChannelDecorator(new 
AuthenticationDecorator())
                                                     .build();
-                        notify(GRPCChannelStatus.CONNECTED);
                         reconnectCount = 0;
                         reconnect = false;
+                        notify(GRPCChannelStatus.CONNECTED);
                     } else if (managedChannel.isConnected(++reconnectCount > 
Config.Agent.FORCE_RECONNECTION_PERIOD)) {
                         // Reconnect to the same server is automatically done 
by GRPC,
                         // therefore we are responsible to check the 
connectivity and
                         // set the state and notify listeners
                         reconnectCount = 0;
-                        notify(GRPCChannelStatus.CONNECTED);
                         reconnect = false;
+                        notify(GRPCChannelStatus.CONNECTED);
                     }
 
                     return;

Reply via email to