dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

SpringExtensionFactory 导致的OOM

Open JoeXie opened this issue 8 years ago • 5 comments

使用256版本dubbo,测试时候发现应用有OOM,dump日志后发现大量的 SpringExtensionFactory中的hashmap占了真个4G内存的76%,发现加载了大量不同的xmlwebapplication对象.

什么情况下会导致SpringExtensionFactory重复加载xmlwebapplication?

以下是dump出来的内存占用分析: image

JoeXie avatar Aug 29 '18 12:08 JoeXie

@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 avatar Aug 30 '18 06:08 diecui1202

@diecui1202 Our env is test. and tomcat reloadble is false. image

JoeXie avatar Aug 30 '18 11:08 JoeXie

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.

Jeff-Lv avatar Sep 11 '18 09:09 Jeff-Lv

@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.

beiwei30 avatar Sep 13 '18 07:09 beiwei30

thx all @beiwei30 @Jeff-Lv I will look into my code again of checking is there any misuse of dubbo.

JoeXie avatar Sep 22 '18 06:09 JoeXie