Bug 63482 - Application hang because of autoSizeColumn
Summary: Application hang because of autoSizeColumn
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 4.0.0-FINAL
Hardware: PC All
: P2 critical with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2019-06-03 15:32 UTC by Vladimir
Modified: 2019-12-10 14:13 UTC (History)
3 users (show)

Snapshot of VisualVM CPU-profiling (184.90 KB, image/png)
2019-12-10 14:07 UTC, None35

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!


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)

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

Comment 4 None35 2019-12-10 14:07:27 UTC
Created attachment 36913 [details]
Snapshot of VisualVM CPU-profiling
Comment 5 None35 2019-12-10 14:12:17 UTC
I confirmed the problem.
It occured with POI-3.17 and POI-4.1.1 when it is used with Java 11.
With Java 8, there is no problem.

I've provided a snapshot of VisualVM CPU-profiling with POI-4.1.1 with both JVM.
It's with a small sheet.

Sorry but I can't provide the application.