对内存dump进行分析:
[Full GC (Ergonomics) [PSYoungGen: 108461K->0K(2247168K)] [ParOldGen: 4737211K->3868172K(4779008K)] 4845673K->3868172K(7026176K), [Metaspace: 116691K->114102K(1165312K)], 1.2683131 secs] [Times: user=11.14 sys=3.38, real=1.26 secs]
查看carte日志,有不少error,怀疑是不是异常发生后未进行资源释放?
查询dump文件的大对象:
占据大量空间的属于pentaho的存储对象ServiceMap
找到问题定位点:
stack org.pentaho.osgi.blueprint.collection.utils.ServiceMap itemAdded 查找调用堆栈
查找包 org.pentaho.osgi.metastore.locator.api.impl.MetastoreLocatorImpl
修改代码,在Trans.java中的
public void execute( String[] arguments ) throws KettleException {
prepareExecution( arguments );
startThreads();
}
添加代码处理:
public void execute(String[] arguments) throws KettleException {
try {
this.prepareExecution(arguments);
}
catch (KettleException e) {
System.out.print("------------------初始化转换失败,手动释放内存");
this.transMeta.disposeEmbeddedMetastoreProvider();
throw e;
}
this.startThreads();
}
观察现象:
配置堆内存7g,半个小时内稳定在oldgen33%
跟踪日志12h,发生5次fullgc,内存正常。