You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 javax.servlet.AsyncListener callback.
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 AsyncRequestInterceptor.
Stepan Koltsov opened SPR-12720 and commented
When async request is timed out, neither HandlerInterceptor.postHandle nor HandlerInterceptor.afterCompletion is called.
How to reproduce a problem.
https://github.com/stepancheg/spring-webmvc-async-interceptor
interesting file is:
https://github.com/stepancheg/spring-webmvc-async-interceptor/blob/master/src/main/java/demo/InterceptorDemo.java
as you see, InterceptorDemo prints to stdout information about all interceptor events.
Start demo from InterceptorDemo class
Open
http://localhost:8080/async?s=61000
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:
Affects: 4.1.4
Issue Links:
Referenced from: commits 1803978
The text was updated successfully, but these errors were encountered: