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
When using Tomcat, closing the application context blocks for two seconds for each DispatcherServlet initialised by a request to the mappings endpoint
#14898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Let me try and explain the problem that I am seeing.
With #13186 support for lazy loading DispatcherServlet when hitting /actuator/mappings has been added to Spring Boot 2.0.6. However, when that happens and one tries to close the application it takes 2s per DispatcherServlet to close its WebApplicationContext (this is on 2.0.6.RELEASE). However, if each context was initialized by hitting it's path then everything is fine. Therefore, I think that there might be some problem with the way the async DispatcherServlet(s) are initialized in the Actuator.
I have created a small project that displays the problem. You can find it here.
Note: #13186 actually does not work with 2.1.0.RC1 (which means that you won't see the problem there, as the other contexts are not initialized).
The text was updated successfully, but these errors were encountered:
Thanks for the sample and detailed description of how to reproduce the problem.
It was #9979 that introduced the code that's causing the problem here and application's that use a separate management port will also be affected. It's the Tomcat-specific logic that ensures that the dispatcher servlet has been initialised that's causing the problem. We force initialisation of the dispatcher servlet by asking Tomcat to allocate a Servlet instance from the wrapper. This instance is never deallocated which causes Tomcat to wait for 2000ms during shutdown for each servlet in this state.
wilkinsona
changed the title
Closing AnnotationConfigWebApplicationContext of async multi servlet registration is slow
Closing AnnotationConfigWebWhen using Tomcat, closing the application context blocks for two seconds for each DispatcherServlet initialised by a request to the mappings endpoint
Oct 19, 2018
wilkinsona
changed the title
Closing AnnotationConfigWebWhen using Tomcat, closing the application context blocks for two seconds for each DispatcherServlet initialised by a request to the mappings endpoint
When using Tomcat, closing the application context blocks for two seconds for each DispatcherServlet initialised by a request to the mappings endpoint
Oct 19, 2018
Note: #13186 actually does not work with 2.1.0.RC1 (which means that you won't see the problem there, as the other contexts are not initialized).
I'm guessing that you're judging this by the log output? With 2.1.0.RC1, your dispatcher servlet is still initialised although the logging is less verbose:
2018-10-19 10:19:46.710 INFO 25285 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'TestServlet service1'
2018-10-19 10:19:46.710 INFO 25285 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'TestServlet service1'
2018-10-19 10:19:46.772 INFO 25285 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 62 ms
And its mappings are included in the output from the mappings endpoint.
If I have misunderstood, can you please open a separate issue (as it's a separate problem) with some more details about the difference in behaviour between 2.0.x and 2.1.
I'm guessing that you're judging this by the log output? With 2.1.0.RC1, your dispatcher servlet is still initialised although the logging is less verbose:
I had some other issues before when the @EnableWebMvc was not there. It is my mistake.
Let me try and explain the problem that I am seeing.
With #13186 support for lazy loading
DispatcherServlet
when hitting/actuator/mappings
has been added to Spring Boot 2.0.6. However, when that happens and one tries to close the application it takes 2s perDispatcherServlet
to close itsWebApplicationContext
(this is on 2.0.6.RELEASE). However, if each context was initialized by hitting it's path then everything is fine. Therefore, I think that there might be some problem with the way the asyncDispatcherServlet
(s) are initialized in the Actuator.I have created a small project that displays the problem. You can find it here.
Note: #13186 actually does not work with 2.1.0.RC1 (which means that you won't see the problem there, as the other contexts are not initialized).
The text was updated successfully, but these errors were encountered: