From 84af1d23834ef3c6ed17980c5270fc42d6e7d5b3 Mon Sep 17 00:00:00 2001 From: haoyann <43994656+haoyann@users.noreply.github.com> Date: Sun, 13 Dec 2020 21:28:36 +0800 Subject: [PATCH] Fix the unexpected RunningContext recreation in the Tomcat plugin. (#6001) --- CHANGES.md | 1 + .../apm/plugin/tomcat78x/TomcatInvokeInterceptor.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 3bd66b5633..d2094a6dfd 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -12,6 +12,7 @@ Release Notes. * The operation name of quartz-scheduler plugin, has been changed as the `quartz-scheduler/${className}` format. * Fix jdk-http and okhttp-3.x plugin did not overwrite the old trace header. * Support collecting logs of log4j, log4j2, and logback in the tracing context with a new `logger-plugin`. +* Fix the unexpected RunningContext recreation in the Tomcat plugin. #### OAP-Backend * Make meter receiver support MAL. diff --git a/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat78x/TomcatInvokeInterceptor.java b/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat78x/TomcatInvokeInterceptor.java index 851dd4124a..94772da1e8 100644 --- a/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat78x/TomcatInvokeInterceptor.java +++ b/apm-sniffer/apm-sdk-plugin/tomcat-7.x-8.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/tomcat78x/TomcatInvokeInterceptor.java @@ -101,8 +101,8 @@ public class TomcatInvokeInterceptor implements InstanceMethodsAroundInterceptor if (!TomcatPluginConfig.Plugin.Tomcat.COLLECT_HTTP_PARAMS && span.isProfiling()) { collectHttpParam(request, span); } - ContextManager.stopSpan(); ContextManager.getRuntimeContext().remove(Constants.FORWARD_REQUEST_FLAG); + ContextManager.stopSpan(); return ret; } -- GitLab