Bug 63482 - Application hang because of autoSizeColumn
Summary: Application hang because of autoSizeColumn
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.0.0-FINAL
Hardware: PC All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-03 15:32 UTC by Vladimir
Modified: 2019-10-05 06:09 UTC (History)
2 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir 2019-06-03 15:32:25 UTC
I have a problem with autoSizeColumn with small number of columns and data.
I have an application which generates XLSX files in different threads. 
I have changed the POI version from 3.17 to 4.1.0 and the application became to hang on the autoSizeColumn(sheet, true) line. 
When I had removed this line or had changed to sheet.setColumnWidth(i, SMALL_COLUMN_WIDTH) the problem was resolved.

There aren't excpetions in the log file!


-----Versions-----

1) OS: Windows 10

2) Java
java version "11.0.3" 2019-04-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.3+12-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.3+12-LTS, mixed mode)

3)
POI version: 4.1.0
Comment 1 Vladimir 2019-06-03 15:59:31 UTC
Small clarification: autoSizeColumn() works fine wit POI version 3.17 and Java 8
Comment 2 Dominik Stadler 2019-06-20 08:15:25 UTC
Can you provide a small sample application which reproduces the problem? Without it is very hard to investigate such a bug-report.
Comment 3 Cody Lerum 2019-10-04 22:30:08 UTC
I ran into this same issue today when making the move from Java 8 to Java 11 and from POI 3.17 to 4.1.0 and I've narrowed this down to a slowdown with Java 11. It doesn't matter if you are running 3.17 or 4.1.0

When running the simple reproducer (taken from the SSPerformanceTest) below with POI 4.1.0


Elapsed 2.71 seconds for arguments [HSSF, 5000, 15, 1] on Java 1.8.0_212

Elapsed 35.08 seconds for arguments [HSSF, 5000, 15, 1] on Java 11.0.4

Elapsed 33.27 seconds for arguments [HSSF, 5000, 15, 1] on Java 12.0.1

The situation seems resolved in Java 13

Elapsed 3.44 seconds for arguments [HSSF, 5000, 15, 1] on Java 13


FYI this This is still an issue on the latest nightly pulled from AdoptOpenJDK:

Elapsed 37.13 seconds for arguments [HSSF, 5000, 15, 1] on Java 11.0.5

Commenting out the sheet.autoSizeColumn(i) yields:
Elapsed 0.54 seconds for arguments [HSSF, 5000, 15, 1] on Java 11.0.5



https://gist.github.com/codylerum/5e302c4cd69e133206ddde9e50f44daa