[ https://issues.apache.org/jira/browse/PDFBOX-3071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14982074#comment-14982074 ]
John Hewson edited comment on PDFBOX-3071 at 10/30/15 7:45 AM: --------------------------------------------------------------- Looking at the stack trace, the problem occurs in the constructor of PDType1CFont, apparently while trying to read an embedded font. This isn't somewhere I'd necessarily expect to see threading issues, especially as the CFFParser isn't shared. I suspect that the underlying input stream is the issue - are you using scratch files when creating the PDDocument? (or are you creating from a source other than a File / FileInputStream?). was (Author: jahewson): Looking at the stack trace, the problem occurs in the constructor of PDType1CFont, apparently while trying to read an embedded font. This isn't somewhere I'd necessarily expect to see threading issues, except of course, especially as the CFFParser isn't shared. I suspect that the underlying input stream is the issue - are you using scratch files when creating the PDDocument? (or are you creating from a source other than a File / FileInputStream?). > Possible thread safety issue RE: Can't read the embedded Type1C font > ILCMJJ+TimesNewRomanPSMT > --------------------------------------------------------------------------------------------- > > Key: PDFBOX-3071 > URL: https://issues.apache.org/jira/browse/PDFBOX-3071 > Project: PDFBox > Issue Type: Bug > Components: FontBox > Affects Versions: 2.0.0 > Environment: JDK 1.7.0_79 on RHEL7 x86_64 > Reporter: Stan R > Attachments: PDFBOX-3071.pdf > > > Further testing reveals that this specific error crops up randomly, and > sometimes simultaneously, while rendering multiple pages from the same > document concurrently. Possibly a thread safety issue with Fontbox? > The rendering happens inside a batch of Callable's running inside a 32-thread > Executor. The code snippet from inside the body of the Callable.call() is > really trivial: > ... > PDFRenderer renderer = new PDFRenderer(document); // referring to the same > document object > BufferedImage image = renderer.renderImage(pageIdx); // exception thrown from > here > ... > ===== ORIGINAL ISSUE REPORT FOLLOWS ==== > Got an exception when rendering page 2 of the file. > The file shows up fine in evince and pdfjs; it appears to be the same font > as everywhere else in the file (but I haven't looked inside the PDF). > The exception is listed below: > WARN [11:19:10.057] [pool-3-thread-3] o.a.p.f.FlateFilter - FlateFilter: > premature end of stream due to a DataFormatException > ERROR [11:19:10.073] [pool-3-thread-3] o.a.p.p.f.PDType1CFont - Can't read > the embedded Type1C font ILCMJJ+TimesNewRomanPSMT > java.io.IOException: illegal offset value 8238 in CFF font > at org.apache.fontbox.cff.CFFParser.readIndexData(CFFParser.java:158) > ~[fontbox-2.0.0-20151027.193416-1850.jar:2.0.0-SNAPSHOT] > at org.apache.fontbox.cff.CFFParser.parseFont(CFFParser.java:393) > ~[fontbox-2.0.0-20151027.193416-1850.jar:2.0.0-SNAPSHOT] > at org.apache.fontbox.cff.CFFParser.parse(CFFParser.java:115) > ~[fontbox-2.0.0-20151027.193416-1850.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.pdmodel.font.PDType1CFont.<init>(PDType1CFont.java:101) > ~[pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:60) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:123) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:811) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:468) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:442) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:149) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:179) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.rendering.PDFRenderer.renderPage(PDFRenderer.java:208) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:139) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:68) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:55) > [pdfbox-2.0.0-20151027.193546-1797.jar:2.0.0-SNAPSHOT] > at > com.example.core.pdf.AsyncPDFRenderer$RenderPDFPageTask.call(AsyncPDFRenderer.java:109) > [classes/:na] > at > com.example.core.pdf.AsyncPDFRenderer$RenderPDFPageTask.call(AsyncPDFRenderer.java:90) > [classes/:na] > at java.util.concurrent.FutureTask.run(FutureTask.java:262) > [na:1.7.0_79] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > [na:1.7.0_79] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > [na:1.7.0_79] > at java.lang.Thread.run(Thread.java:745) [na:1.7.0_79] > WARN [11:19:10.350] [pool-3-thread-3] o.a.p.p.f.FileSystemFontProvider - > New fonts found, font cache will be re-built > WARN [11:19:10.350] [pool-3-thread-3] o.a.p.p.f.FileSystemFontProvider - > Building font cache, this may take a while > ... -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org