Skip to content
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

easyexcle从3.1.1升级到4.0.3,jdk从8升级到jdk21,使用fillData()应用出现OOM #4024

Open
9199 opened this issue Oct 17, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@9199
Copy link

9199 commented Oct 17, 2024

异常代码

   try (ExcelWriter excelWriter = EasyExcel
                .write(this.resultFilePath)
                .withTemplate(templateFilePath)
                .excelType(ExcelTypeEnum.XLSX)
                .build()) {
            WriteSheet build = EasyExcel.writerSheet(0).build();
            List<RecruitmentMonthlyRecordsFillData> data = fillData(endDate);
            excelWriter.fill(data, build);
        }

问题描述

代码如上所示
jdk8 -> jdk21
springboot2.7.8 -> springboot3.2.8
easyexcel3.1.1 -> 4.0.3

通过Arthas分析发现,在最后的com/alibaba/excel/ExcelWriter.close方法中,占用了大量内存。
继续向下分析发现 org/apache/poi/xssf/streaming/SXSSFWorkbook.copyStreamAndInjectWorksheet方法是性能损耗最大的地方

依赖版本如下:

image

内存火焰图如下:

jdk21+springboot3.2.8+easyexcel4.0.3版本中 火焰图如下:
image

jdk1.8+springboot2.7.8+easyexcel4.0.3版本中 火焰图如下:
image

相同的版本,相同的代码,jdk和springboot的版本不同,两张火焰图里面的close方法差别很大

@9199 9199 added the help wanted Extra attention is needed label Oct 17, 2024
@alibaba alibaba deleted a comment Oct 28, 2024
@Suomm
Copy link

Suomm commented Nov 2, 2024

@zhuangjiaju 复现成功,EasyExcel 版本 4.0.3 JDK21

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants