[ 
https://issues.apache.org/jira/browse/IGNITE-12979?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guo XuBo updated IGNITE-12979:
------------------------------
    Component/s:     (was: clients)
                 general

> Peer-class-loading behavior causes the server's metaspace out of memory
> -----------------------------------------------------------------------
>
>                 Key: IGNITE-12979
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12979
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 2.7, 2.8, 2.7.5, 2.7.6
>         Environment: jdk 8 
> server set jvm param -XX:MaxMetaspaceSize=512m
>            Reporter: Guo XuBo
>            Priority: Major
>             Fix For: None
>
>
> In Shared mode deployment, peer-class-loading behavior causes the server to 
> run out of memory(metaspace) if the client starts ,sends compute task, , and 
> often stops. I dump the JVM heap and found GridDeploymentClassLoader class 
> without unloading.I then debugged it locally and found the following code in 
> the GridResourceProcessor class, which passed a null value into the 
> ioc.descriptor method, causing the GridResourceIoc's taskMap property not to 
> store the corresponding information, which in turn caused the 
> GridResourceIoc's onUndeploy method not to unload the clsDescs corresponding 
> class information (and possibly other references), which caused OOM.
> {code:java}
> //ignite 2.8.0  GridResourceProcessor class 261-267 line
> private void inject(Object obj,
>     GridResourceIoc.AnnotationSet annSet,
>     @Nullable GridDeployment dep,
>     @Nullable Class<?> depCls,
>     Object... params)
>     throws IgniteCheckedException {
>     GridResourceIoc.ClassDescriptor clsDesc = ioc.descriptor(null, 
> obj.getClass());
> ……
> }{code}
> Test code:
> {code:java}
> //client code
> public class Task implements IgniteRunnable {
>     private int num;
>     public Task(int j) {
>         this.num = j;
>     }
>     @Override
>     public void run() {
>         System.out.println(num);
>     }
> }
> {code}
>  
> {code:java}
> //client start code
> final IgniteConfiguration configuration = new IgniteConfiguration();
> configuration.setPeerClassLoadingEnabled(true);
> configuration.setClientMode(true);
> for (int i = 0; i < 10000; i++) {
>     final Ignite start = Ignition.start(configuration);
>     start.compute().run(new Task(i));
>     start.close();
> }
> {code}
> {code:java}
>  // server -XX:MaxMetaspaceSize=100m
> final IgniteConfiguration igniteConfiguration = new IgniteConfiguration(); 
> igniteConfiguration.setPeerClassLoadingEnabled(true); final Ignite ignite = 
> Ignition.start(igniteConfiguration);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to