apache / skywalking

APM, Application Performance Monitoring System
https://skywalking.apache.org/
Apache License 2.0
23.7k stars 6.5k forks source link

Ignoring url using the trace-ignore-plugin plug-in throw a java.lang.NullPointerException #6674

Closed markusleevip closed 3 years ago

markusleevip commented 3 years ago

Bug

/apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/context/ContextManager.java


    /**
     * Recommend use ContextManager::stopSpan(AbstractSpan span), because in that way, the TracingContext core could
     * verify this span is the active one, in order to avoid stop unexpected span. If the current span is hard to get or
     * only could get by low-performance way, this stop way is still acceptable.
     */
    public static void stopSpan() {
        final AbstractTracerContext context = get();
        // Throw NullPointerException
        stopSpan(context.activeSpan(), context);
    }

error log

2021-04-02 10:55:03,218 [TID:Ignored_Trace] [XNIO-1 task-1] [com.demo.home.HomeController] [INFO] - I am hello. log4j
2021-04-02 10:55:03,220 [TID:N/A] [XNIO-1 task-1] [org.jboss.threads.errors] [ERROR] - Thread Thread[XNIO-1 task-1,5,main] threw an uncaught exception
java.lang.NullPointerException
    at org.apache.skywalking.apm.agent.core.context.ContextManager.stopSpan(ContextManager.java:199)
    at org.apache.skywalking.apm.plugin.undertow.v2x.SWRunnable.run(SWRunnable.java:47)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449)
    at java.lang.Thread.run(Thread.java:748)
wu-sheng commented 3 years ago

This may be a bug of webflux. Ignoring plugin has not relationship with this npe.

markusleevip commented 3 years ago

This is a repeat problem. Hope to fix it.

wu-sheng commented 3 years ago

This is a repeat problem. Hope to fix it.

Fixing belongs to the whole community, including yourself. Taking action rather than a hope. Hope means no one is doing this now.