SpringExtensionFactory 导致的OOM
使用256版本dubbo,测试时候发现应用有OOM,dump日志后发现大量的 SpringExtensionFactory中的hashmap占了真个4G内存的76%,发现加载了大量不同的xmlwebapplication对象.
什么情况下会导致SpringExtensionFactory重复加载xmlwebapplication?
以下是dump出来的内存占用分析:

@JoeXie Does this problem occur on the product or test environment ? If test environment, maybe you could check whether the reload mechanism is enabled, such as tomcat reload.
@diecui1202
Our env is test.
and tomcat reloadble is false.

From the screenshot provided, the applicationContexts are created repeatly to have different object reference ID when use Dubbo referenceBEan or serviceBean. It should be a problem of misuse from user side.
It is better to attach the test code @JoeXie . If no , we can close this issue later.
@JoeXie I agree with @Jeff-Lv that the spring context is repeatedly created in your application, and dubbo doesn't do it, see this: https://github.com/apache/incubator-dubbo/blob/2.5.x/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java#L33
public static void addApplicationContext(ApplicationContext context) {
contexts.add(context);
}
Dubbo will not create spring context for user.
thx all @beiwei30 @Jeff-Lv I will look into my code again of checking is there any misuse of dubbo.