Today one of our customer ran into a known JVM bug when trying to render a PDF document that crashed the JVM using our PDF library jPDFProcess

The bug is reproducible always but we had to run the same sample many times before we were able to get Java to create an hs_err_pid.log file for the crash.

Looking at the error file, we were able to trace it back to this known Java bug:
https://bugs.openjdk.java.net/browse/JDK-8149031

Here is an extract of the hs_err_pid.log:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.dc.pr.PathDasher.appendCubic(FFFFFF)V+0
J 969 C1 sun.dc.pr.Rasterizer.appendCubic(FFFFFF)V (55 bytes) @ 0x019d8394 [0x019d8310+0x84]
J 362 C1 sun.dc.DuctusRenderingEngine.getAATileGenerator(Ljava/awt/Shape;Ljava/awt/geom/AffineTransform;Lsun/java2d/pipe/Region;Ljava/awt/BasicStroke;ZZ[I)Lsun/java2d/pipe/AATileGenerator; (1189 bytes) @ 0x018ffaa0 [0x018fecb0+0xdf0]
J 1150 C1 sun.java2d.pipe.AAShapePipe.renderPath(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;Ljava/awt/BasicStroke;)V (86 bytes) @ 0x01a4174c [0x01a415f0+0x15c]
j  sun.java2d.pipe.AAShapePipe.draw(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;)V+38
j  sun.java2d.pipe.PixelToParallelogramConverter.draw(Lsun/java2d/SunGraphics2D;Ljava/awt/Shape;)V+156
j  sun.java2d.SunGraphics2D.draw(Ljava/awt/Shape;)V+6

This bug probably only happens when drawing very specific shapes as this is the first time that we run into this bug.

Workaround:

We were able to run our library in Java 9 and confirm that this bug is indeed fixed in Java 9. Version v2018R1 of Qoppa’s PDF library and component will be compatible with Java 9. Upgrade to version v2018R1 when available.

Tagged: