Hi,

problem seems to be at DrawTextParagraph.java:417, TextLayout.getAdvance()
sometimes returns 0 for OpenJDK. In the statements "(int)Math.ceil(tabSz /
wspace)" the division by zero leads to "Infinity", which Math.ceil()
converts to Integer.MAX_VALUE, thus we try to create a string with that
many spaces.

Simple fix may be to adjust wspace to non-zero in this case as it probably
is not useful to use "0" for wspace here.

I didn't see any related change in POI for some time, so it may be caused
by changes in recent OpenJDK versions.

Dominik.


On Sat, Feb 1, 2020 at 10:48 AM Dominik Stadler <[email protected]>
wrote:

>
> Sorry, I was wrong, it actually only works with JDK 8_201, but fails with
> OOM on OpenJKD 8_232, so some change between those two versions of the JDK
> might be related.
>
> BTW, CI on Jenkins still uses patch-level 191, which is quite outdated
> nowadays...
>
> Dominik.
>
> On Sat, Feb 1, 2020 at 10:34 AM Dominik Stadler <[email protected]>
> wrote:
>
>> Hi,
>>
>> target "jenkins" works fine for me with
>>
>> export ANT_OPTS="-Xmx1024m"
>>
>> and no changes to the build.xml both with JDK 8_201 and OpenJDK 8_232
>>
>> Dominik.
>>
>> On Fri, Jan 31, 2020 at 9:01 PM Andreas Beeker <[email protected]>
>> wrote:
>>
>>> I'm running into 4x OOMs when running the integration tests in Open or
>>> Oracle Jdk 8, even when raising the heap from 1512 to 2048 mb.
>>> This didn't happen with OpenJDK 12 - which was my default setting before
>>> :|
>>>
>>> It looks like there's a problem with XSLF (see below, although this is
>>> probably not the location where the memory leak is happening)
>>>
>>> Andi
>>>
>>>
>>> Testcase: testAllFiles[845: slideshow/Divino_Revelado.pptx using
>>> org.apache.poi.stress.XSLFFileHandler@396a51ab] took 2.339 sec
>>>     Caused an ERROR
>>> Java heap space
>>> java.lang.OutOfMemoryError: Java heap space
>>>     at java.util.Arrays.copyOf(Arrays.java:3332)
>>>     at
>>> java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:124)
>>>     at
>>> java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:649)
>>>     at java.lang.StringBuilder.append(StringBuilder.java:202)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextParagraph.tab2space(DrawTextParagraph.java:427)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextParagraph.getRenderableText(DrawTextParagraph.java:386)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextParagraph.getRenderableText(DrawTextParagraph.java:381)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextParagraph.getAttributedString(DrawTextParagraph.java:564)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextParagraph.breakText(DrawTextParagraph.java:258)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextShape.drawParagraphs(DrawTextShape.java:158)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextShape.getTextHeight(DrawTextShape.java:220)
>>>     at
>>> org.apache.poi.sl.draw.DrawTextShape.drawContent(DrawTextShape.java:104)
>>>     at
>>> org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:107)
>>>     at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71)
>>>     at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:41)
>>>     at org.apache.poi.xslf.usermodel.XSLFSlide.draw(XSLFSlide.java:373)
>>>     at
>>> org.apache.poi.stress.SlideShowHandler.renderSlides(SlideShowHandler.java:152)
>>>     at
>>> org.apache.poi.stress.SlideShowHandler.handleSlideShow(SlideShowHandler.java:46)
>>>     at
>>> org.apache.poi.stress.XSLFFileHandler.handleFile(XSLFFileHandler.java:43)
>>>     at org.apache.poi.TestAllFiles.testAllFiles(TestAllFiles.java:433)
>>>
>>>
>>>

Reply via email to