Bug 64806 - draw method hangs on slide of attached PowerPoint file
Summary: draw method hangs on slide of attached PowerPoint file
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: unspecified
Hardware: PC All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-10-12 22:44 UTC by Eric Schoen
Modified: 2020-10-15 22:37 UTC (History)
0 users



Attachments
File that hangs when rendering (71.19 KB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2020-10-12 22:44 UTC, Eric Schoen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Schoen 2020-10-12 22:44:52 UTC
Created attachment 37498 [details]
File that hangs when rendering

We're running into an infinite loop trying to render the HWMF on the attached slide

java.lang.Thread.State: RUNNABLE
        at sun.dc.pr.PathDasher.appendLine(Native Method)
        at sun.dc.DuctusRenderingEngine.feedConsumer(DuctusRenderingEngine.java:281)
        at sun.dc.DuctusRenderingEngine.strokeTo(DuctusRenderingEngine.java:158)
        at sun.java2d.pipe.LoopPipe.getStrokeSpans(LoopPipe.java:278)
        at sun.java2d.pipe.LoopPipe.draw(LoopPipe.java:201)
        at sun.java2d.pipe.PixelToParallelogramConverter.draw(PixelToParallelogramConverter.java:148)
        at sun.java2d.pipe.ValidatePipe.draw(ValidatePipe.java:154)
        at sun.java2d.SunGraphics2D.draw(SunGraphics2D.java:2497)
        at org.apache.poi.hwmf.draw.HwmfGraphics.draw(HwmfGraphics.java:170)
        at org.apache.poi.hemf.record.emfplus.HemfPlusDraw$EmfPlusDrawPath.draw(HemfPlusDraw.java:220)
        at org.apache.poi.hemf.draw.HemfGraphics.draw(HemfGraphics.java:123)
        at org.apache.poi.hemf.record.emf.HemfComment$EmfCommentDataPlus$$Lambda$438/534949923.accept(Unknown Source)
        at java.util.ArrayList.forEach(ArrayList.java:1257)
        at org.apache.poi.hemf.record.emf.HemfComment$EmfCommentDataPlus.draw(HemfComment.java:307)
        at org.apache.poi.hemf.record.emf.HemfComment$EmfComment.draw(HemfComment.java:128)
        at org.apache.poi.hemf.draw.HemfGraphics.draw(HemfGraphics.java:107)
        at org.apache.poi.hemf.usermodel.HemfPicture.draw(HemfPicture.java:179)
        at org.apache.poi.hemf.draw.HemfImageRenderer.drawImage(HemfImageRenderer.java:117)
        at org.apache.poi.sl.draw.DrawPictureShape.drawContent(DrawPictureShape.java:64)
        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)
Comment 1 Andreas Beeker 2020-10-12 23:20:08 UTC
I've rendered it with Java 8 and it took ~27 sec. hanging several times in the stack you've mentioned, because of some bad scaling values.
Then I've tried Java 14 and it took ~2 sec.

Which Java version are you using?
Comment 2 Andreas Beeker 2020-10-12 23:20:08 UTC
I've rendered it with Java 8 and it took ~27 sec. hanging several times in the stack you've mentioned, because of some bad scaling values.
Then I've tried Java 14 and it took ~2 sec.

Which Java version are you using?
Comment 3 Eric Schoen 2020-10-12 23:22:12 UTC
Java 8.  Oracle Java 1.8.0_161-b12 on a Mac hangs effectively forever.  I gave up after an hour.
Comment 4 Eric Schoen 2020-10-12 23:23:53 UTC
I should add we've also tried this under OpenJDK 1.8.0_252-b09 on CentOS and seen the same effectively infinite hand.
Comment 5 Andreas Beeker 2020-10-15 22:37:26 UTC
Although when running this on OpenJDK (build 1.8.0_265-8u265-b01-0ubuntu2~20.04-b01) it took 52sec, you might want to enable the marlin engine.

see https://github.com/AdoptOpenJDK/openjdk-build/issues/716 for details

tl;dr:
* download the jar from https://github.com/bourgesl/marlin-renderer/releases/tag/v0_9_4_3
* add -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine
-Xbootclasspath/a:<path>/marlin-0.9.4.3-Unsafe.jar

or if you are updating to u262 and later you can use:
-Dsun.java2d.renderer=sun.java2d.marlin.MarlinRenderingEngine