You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/02/24 06:59:50 UTC

[skywalking] branch master updated: Fix apm-dubbo-2.7.x-plugin memory leak due to some Dubbo RpcExceptions. (#6432)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8c3d167  Fix apm-dubbo-2.7.x-plugin memory leak due to some Dubbo RpcExceptions. (#6432)
8c3d167 is described below

commit 8c3d1679e37f992b697835b2402401a26eac19e8
Author: osiriswd <os...@gmail.com>
AuthorDate: Wed Feb 24 14:59:41 2021 +0800

    Fix apm-dubbo-2.7.x-plugin memory leak due to some Dubbo RpcExceptions. (#6432)
---
 CHANGES.md                                                       | 1 +
 .../apache/skywalking/apm/plugin/asf/dubbo/DubboInterceptor.java | 9 +++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 1e596f0..a26d20f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -14,6 +14,7 @@ Release Notes.
 * Fix ClassCastException of log4j gRPC reporter.
 * Fix NPE when Kafka reporter activated.
 * Enhance gRPC log appender to allow layout pattern.
+* Fix apm-dubbo-2.7.x-plugin memory leak due to some Dubbo RpcExceptions.
 
 #### OAP-Backend
 * Allow user-defined `JAVA_OPTS` in the startup script.
diff --git a/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/DubboInterceptor.java b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/DubboInterceptor.java
index 9a8d1ae..3ccffbe 100644
--- a/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/DubboInterceptor.java
+++ b/apm-sniffer/apm-sdk-plugin/dubbo-2.7.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/asf/dubbo/DubboInterceptor.java
@@ -24,6 +24,7 @@ import org.apache.dubbo.rpc.Invocation;
 import org.apache.dubbo.rpc.Invoker;
 import org.apache.dubbo.rpc.Result;
 import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.RpcException;
 import org.apache.skywalking.apm.agent.core.context.CarrierItem;
 import org.apache.skywalking.apm.agent.core.context.ContextCarrier;
 import org.apache.skywalking.apm.agent.core.context.ContextManager;
@@ -109,8 +110,12 @@ public class DubboInterceptor implements InstanceMethodsAroundInterceptor {
     public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
                               Object ret) throws Throwable {
         Result result = (Result) ret;
-        if (result != null && result.getException() != null) {
-            dealException(result.getException());
+        try {
+            if (result != null && result.getException() != null) {
+                dealException(result.getException());
+            }
+        } catch (RpcException e) {
+            dealException(e);
         }
 
         ContextManager.stopSpan();