Actuator: NPE in LongTaskTimingHandlerInterceptor
See original GitHub issueI encountered the following NPE in Spring Boot Actuator 2.1.3.RELEASE:
java.lang.NullPointerException: null
at org.springframework.boot.actuate.metrics.web.servlet.LongTaskTimingHandlerInterceptor.stopLongTaskTimers(LongTaskTimingHandlerInterceptor.java:123)
at org.springframework.boot.actuate.metrics.web.servlet.LongTaskTimingHandlerInterceptor.afterCompletion(LongTaskTimingHandlerInterceptor.java:78)
at org.springframework.web.servlet.HandlerExecutionChain.triggerAfterCompletion(HandlerExecutionChain.java:174)
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletion(DispatcherServlet.java:1424)
…
I believe the assumption is that LongTaskTimingContext#get(HttpServletRequest) never returns null. However, it appears that there can be a case where the request does not contain the required attribute.
I think the code should check for null to be safe.
Issue Analytics
- State:
- Created 4 years ago
- Comments:34 (21 by maintainers)
Top Results From Across the Web
Spring Boot Actuator - LDAP Health Endpoint Throwing NPE
This is a spring-ldap bug that has a fix committed, but it doesn't appear to be merged into the main spring-ldap branch yet....
Read more >LongTaskTimingHandlerIntercep...
Class LongTaskTimingHandlerInterceptor. java.lang.Object. org.springframework.boot.actuate.metrics.web.servlet.LongTaskTimingHandlerInterceptor.
Read more >spring-projects/spring-boot - Gitter
In my service the actuator config is in the property file located in the jar itself. When I run it locally, actuator is...
Read more >LongTaskTimingHandlerIntercep...
public class LongTaskTimingHandlerInterceptor extends java.lang.Object implements org.springframework.web.servlet.HandlerInterceptor.
Read more >Spring Boot Actuator - LDAP Health Endpoint Throwing NPE ...
[Solved]-Spring Boot Actuator - LDAP Health Endpoint Throwing NPE-Springboot. Search. score:4. Another solution is to enter credentials into the LDAP Spring ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@wilkinsona I just saw the same stacktrace (from my POV) in an application we are developing (spring-boot 2.3.1). Strangely it occurred multiple times (it’s not when the app shutdowns) and we are using Undertow. Like mentioned in this ticket I think it is related to a new end-point we wrote which is
syncand should beasync@urosht As far as we know, the problem only occurs in Tomcat during shutdown with a long-running synchronous response. As explained in this comment we are not planning to make any changes to address things with Tomcat. The problem can and should be avoided by using an async response via
DeferredResultor similar and tuning the unload delay.The Undertow problem is different as it can occur at any time if a client closes a connection to which the server was still writing data. This will have to be fixed in Undertow.