pjfanning opened a new pull request, #1277: URL: https://github.com/apache/poi/pull/1277
### Problem The gradle CI job on GitHub Actions never sets `CI_BUILD`, so `poi-integration` ran with the root 2g heap and one test thread per processor — the 3g / 2-thread config in `poi-integration/build.gradle` only applied on Jenkins. Under that heap `TestAllFiles` intermittently stalls in `Retried waiting for GCLocker too often` and then kills the JUnit engine with `OutOfMemoryError: Java heap space` (most recently on the Java 21 job for #1276; the ant-only heap bump in fff2528eb5 did not reach the gradle job). ### Heap settings - `poi-integration/build.gradle`: `maxHeapSize = '3g'` unconditionally; the fixed 2-thread parallelism now also triggers on `CI=true` (set by GitHub Actions), not only `CI_BUILD`. - `build.xml`: ant integration-test heap 2048 → 3072 to match. ### Using less memory - **`IOUtils.toByteArray`**: when the length is known and fits the initial allocation (every zip entry ≤ 2MB, every sized record read), read directly into the result array via `readFully` instead of through an `UnsynchronizedByteArrayOutputStream` plus `toByteArray()` copy. Halves the transient memory of every sized read; `EOFException` semantics unchanged. - **`TestAllFiles`**: temp-file threshold 16MB → 2MB. Since #1236 the threshold also bounds how much of an *unknown-size* entry is buffered on the heap before spilling. Workbooks POI writes to a non-seekable stream use data descriptors (unknown size), and `SpreadsheetHandler` re-reads exactly such a stream for every spreadsheet — so since #1236 the parts of every re-read workbook had moved from temp files onto the heap. All the OOM failures listed in fff2528eb5 post-date #1236. - **`SpreadsheetHandler`**: the first write (output discarded) goes to `NullOutputStream`; the second write's buffer is scoped so it is not live while the re-read workbook is processed. - **`XSSFFileHandler` / `OPCFileHandler` / `XSSFBFileHandler`**: `OPCPackage`s opened from streams were never closed; each kept every decompressed part alive until GC. ### Testing `TestIOUtils` and `org.apache.poi.openxml4j.util.*` pass locally; relying on CI for the full `poi`, `poi-ooxml` and `poi-integration` runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
