-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid full synchronization in AbstractRefreshableApplicationContext.getBeanFactory() since it can lead to massive thread blocking #25081
Comments
Which code path typically hits the blocking there? Some form of That said, we might be able to rework this (rather old) |
I'm just trying to collect some cases. Here's an first interesting one which is a pure Spring one (TenantIgnoreXmlWebApplicationContext is our class but doesn't override containsBean() or anything in the way ). Seems that each request going through
|
Indeed, some of our filter implementations and also some web integration delegates (e.g. for JSF) call While we could revise those spots to hold on to the nested |
I'm not sure where there is a nested BeanFactory, because in our stack traces there are always just those two two methods 'above' our own call to
May be we're missing out on something before that call, when we look up the current web application context the way below. (It's a static utility method we need for our legacy code base, just in case you wonder.)
|
Aside of that |
spring-framework/spring-context/src/main/java/org/springframework/context/support/AbstractRefreshableApplicationContext.java
Line 175 in b122483
On large servers running Tomcat with lots of cores we see massive thread blocking in
getBeanFactory()
due to the synchronized block. This is hit as we're usingXmlWebApplicationContext
and any time a bean is looked up during a web request the bean factory is required.Outside of web applications we're also having another context using
GenericXmlApplicationContext
which doesn't have that problem.Would be great to get some insight to either find a workaround on our side or fix the implementation.
Thank you
Axel
The text was updated successfully, but these errors were encountered: