From 61e0e6de7b255a24ee8e36e62ce2cf6ae80423b2 Mon Sep 17 00:00:00 2001 From: PepoRobert <281918681@qq.com> Date: Sun, 19 Dec 2021 15:16:09 +0800 Subject: [PATCH] Fix httpasyncclient-4.x-plugin's memory leak risk (#85) --- .../httpasyncclient/v4/LeaseRequestCompletedInterceptor.java | 1 + changes/changes-8.8.0.md | 1 + 2 files changed, 2 insertions(+) diff --git a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java index 8b4bdc80c..61dd2df4e 100644 --- a/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/httpasyncclient-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/httpasyncclient/v4/LeaseRequestCompletedInterceptor.java @@ -37,6 +37,7 @@ public class LeaseRequestCompletedInterceptor implements InstanceMethodsAroundIn conn.getContext().setAttribute(Constants.SKYWALKING_CONTEXT_SNAPSHOT, ContextManager.capture()); conn.getContext().setAttribute(Constants.SKYWALKING_HTTP_CONTEXT, Constants.HTTP_CONTEXT_LOCAL.get()); } + Constants.HTTP_CONTEXT_LOCAL.remove(); } @Override diff --git a/changes/changes-8.8.0.md b/changes/changes-8.8.0.md index 52021e47a..c61880178 100644 --- a/changes/changes-8.8.0.md +++ b/changes/changes-8.8.0.md @@ -40,6 +40,7 @@ Release Notes. * Add plugin to support okhttp 2.x * Optimize okhttp 3.x 4.x plugin to get span time cost precisely * Adapt message header properties of RocketMQ 4.9.x +* Fix httpasyncclient-4.x-plugin's memory leak risk #### Documentation