Repository navigation
Skip storing the dispatcher target when the servlet context returns no dispatcher (quick fix) - #12802
Conversation
…o dispatcher ServletContext.getRequestDispatcher/getNamedDispatcher return null for an unknown path or servlet name (e.g. Tomcat's ApplicationContext). The exit advice then used that null dispatcher as a context store key, which throws an NPE in the weak-map fallback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
There was a problem hiding this comment.
More details
The null guard prevents missing dispatchers from reaching the context store while preserving target storage for non-null dispatchers. Regression coverage addresses both dispatcher lookup methods.
🤖 Bits Code Review · Commit 6858d09 · @DataDog review to ask questions
This comment has been minimized.
This comment has been minimized.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for 4fc605b: What to do next?
DetailsSince those jobs are not marked as being allowed to fail, the pipeline will most likely fail. |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
c9fb9f1
into
master
What Does This Do
ServletContextInstrumentation.RequestDispatcherTargetAdvicenow returns early whengetRequestDispatcher/getNamedDispatcherreturnsnull, instead of using the null dispatcher as a context-store key.Motivation
Error Tracking: https://app.datadoghq.com/error-tracking/issue/7ddef69a-aab1-11f0-8060-da7ad0900002 ("Failed to handle exception in instrumentation for org.apache.catalina.core.ApplicationContext"):
Servlet containers return
nullfor an unknown path or servlet name. Tomcat'sApplicationContextdoes this, for example. Anullkey fails theKeyWithValuecheck inFieldBackedContextStore, so it falls through to the weak-map fallback, andWeakConcurrentMaprejects null keys. The error was suppressed and logged, so it didn't break the app, but it showed up as noise in instrumentation telemetry.This is the put-side companion of #12692, which fixed the get side (a null servlet context key in the IAST
getSessionadvice).Additional Notes
ServletContextNullDispatcherTest(javax-servlet-common). It uses aServletContextthat returnsnulldispatchers. Before the fix it fails throughAbstractInstrumentationTest's instrumentation-error check, with the sameWeakMaps$Adapter.put(WeakMaps.java:75)NPE stack as production. After the fix it passes.:dd-java-agent:instrumentation:servlet:javax-servlet:javax-servlet-common:test,spotlessCheckandspotbugsMainpass.🤖 Generated with Claude Code