Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Document how HandlerInterceptor can hook into async request timedout [SPR-12720] #17317
When async request is timed out, neither HandlerInterceptor.postHandle nor HandlerInterceptor.afterCompletion is called.
How to reproduce a problem.
interesting file is:
as you see, InterceptorDemo prints to stdout information about all interceptor events.
in browser. Wait for 61 second.
Stdout would be like this:
As you may see, postHandle and afterCompletion interceptors are not called.
I don't know any workaround for this problem.
I used latest available spring-boot and its default dependencies, which are:
Referenced from: commits 1803978
Rossen Stoyanchev commented
This is actually expected behavior since there is no Servlet container dispatch when a timeout occurs. In the Servlet 3.0 API a timeout event is exposed as an
So instead a HandlerInterceptor can choose to register to be involved in the timeout from its preHandle method. You can see for example what the OpenSessionInViewFilter and OpenSessionInViewInterceptor do to ensure the Hibernate session is released in case of timeout by registering