[ https://issues.apache.org/jira/browse/PDFBOX-4219?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16472562#comment-16472562 ]
John Hewson commented on PDFBOX-4219: ------------------------------------- Hmm, looks like this is to support nested reading of tables, such as the HorizontalMetricsTable.read which starts by calling getHorizontalHeader > Multithreading problem when rendering several documents with Standard 14 fonts > ------------------------------------------------------------------------------ > > Key: PDFBOX-4219 > URL: https://issues.apache.org/jira/browse/PDFBOX-4219 > Project: PDFBox > Issue Type: Bug > Components: FontBox, Rendering > Affects Versions: 2.0.9, 3.0.0 PDFBox > Environment: Windows 7 > jdk1.8.0_172 > Reporter: Tilman Hausherr > Priority: Major > Labels: multi-threading, multithreading > Attachments: 014261-p3-ccitt.pdf, 014261-p3-ccitt.pdf-1-bad1.png, > 014261-p3-ccitt.pdf-1-bad2.png, 014261-p3-ccitt.pdf-1-bad3.png, > 014261-p3-ccitt.pdf-1.png, 166292-fi-ligature.pdf, > 166292-fi-ligature.pdf-1-bad1.png, 166292-fi-ligature.pdf-1-bad2.png, > 166292-fi-ligature.pdf-1-bad3.png, 166292-fi-ligature.pdf-1.png, > MulithreadTest.java > > > I get rendering errors and sometimes exceptions in my regression tests. It is > somehow related to several threads initializing standard 14 fonts. It happens > only about every 25 times in a test program I created. That one renders 2 > files in 4 threads and compares the result with the existing result. > My theory is that one thread accesses the naming table and another accesses > the glyf table, and both change the stream position. I tried several things > in the last months to avoid it, all were unsuccessful and I lost my notes > about it last winter due to a static discharge on a usb stick. (Thank you > KINGSTON!) > Here's the output when it doesn't go well: > {noformat} > 11.05.2018 10:54:26.322 WARN [pool-1-thread-4] > org.apache.pdfbox.pdmodel.font.PDType1Font:296 - Using fallback font > TimesNewRomanPS-BoldMT for Galliard-Bold > 11.05.2018 10:54:26.323 WARN [pool-1-thread-2] > org.apache.pdfbox.pdmodel.font.PDType1Font:296 - Using fallback font > TimesNewRomanPS-BoldMT for Galliard-Bold > 11.05.2018 10:54:26.386 WARN [pool-1-thread-2] > org.apache.pdfbox.pdmodel.font.PDType1Font:296 - Using fallback font > TimesNewRomanPSMT for Galliard-Roman > 11.05.2018 10:54:26.421 WARN [pool-1-thread-4] > org.apache.pdfbox.pdmodel.font.PDType1Font:296 - Using fallback font > TimesNewRomanPSMT for Galliard-Roman > 11.05.2018 10:54:26.697 WARN [pool-1-thread-2] > org.apache.pdfbox.pdmodel.font.PDType1Font:296 - Using fallback font > TimesNewRomanPS-ItalicMT for Galliard-Italic > 11.05.2018 10:54:26.818 WARN [pool-1-thread-4] > org.apache.pdfbox.pdmodel.font.PDType1Font:296 - Using fallback font > TimesNewRomanPS-ItalicMT for Galliard-Italic > C:\Users\XXX\Documents\Java\PDFBox > reactor\pdfbox\src\test\resources\input\rendering\166292-fi-ligature.pdf > oh oh > C:\Users\XXX\Documents\Java\PDFBox > reactor\pdfbox\src\test\resources\input\rendering\166292-fi-ligature.pdf > oh oh > C:\Users\XXX\Documents\Java\PDFBox > reactor\pdfbox\src\test\resources\input\rendering\014261-p3-ccitt.pdf > oh oh > C:\Users\XXX\Documents\Java\PDFBox > reactor\pdfbox\src\test\resources\input\rendering\014261-p3-ccitt.pdf > oh oh > done > {noformat} > Sometimes in the past I got exceptions: > {noformat} > Exception in thread "Thread-2" java.lang.RuntimeException: > java.io.IOException: Unexpected end of TTF stream reached > at pdfboxpageimageextraction.MulithreadTest.run(MulithreadTest.java:87) > Caused by: java.io.IOException: Unexpected end of TTF stream reached > at org.apache.fontbox.ttf.TTFDataStream.read(TTFDataStream.java:274) > at > org.apache.fontbox.ttf.TTFDataStream.readString(TTFDataStream.java:91) > at org.apache.fontbox.ttf.NamingTable.read(NamingTable.java:113) > at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:373) > at org.apache.fontbox.ttf.TrueTypeFont.getTable(TrueTypeFont.java:163) > at org.apache.fontbox.ttf.TrueTypeFont.getNaming(TrueTypeFont.java:179) > at org.apache.fontbox.ttf.TrueTypeFont.getName(TrueTypeFont.java:471) > at > org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:296) > at > org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:62) > at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143) > at > org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:156) > at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:258) > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:225) > at > org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:164) > {noformat} > Sometimes I get an AIOOBE: > {noformat} > Exception in thread "Thread-1" java.lang.ArrayIndexOutOfBoundsException > at > org.apache.fontbox.ttf.BufferedRandomAccessFile.read(BufferedRandomAccessFile.java:158) > at org.apache.fontbox.ttf.RAFDataStream.read(RAFDataStream.java:167) > at org.apache.fontbox.ttf.TTFDataStream.read(TTFDataStream.java:264) > at > org.apache.fontbox.ttf.TTFDataStream.readString(TTFDataStream.java:91) > at org.apache.fontbox.ttf.NamingTable.read(NamingTable.java:113) > at org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:373) > at org.apache.fontbox.ttf.TrueTypeFont.getTable(TrueTypeFont.java:163) > at org.apache.fontbox.ttf.TrueTypeFont.getNaming(TrueTypeFont.java:179) > at org.apache.fontbox.ttf.TrueTypeFont.getName(TrueTypeFont.java:471) > at > org.apache.pdfbox.pdmodel.font.PDType1Font.<init>(PDType1Font.java:296) > at > org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:62) > at org.apache.pdfbox.pdmodel.PDResources.getFont(PDResources.java:143) > at > org.apache.pdfbox.contentstream.operator.text.SetFontAndSize.process(SetFontAndSize.java:60) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processOperator(PDFStreamEngine.java:853) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStreamOperators(PDFStreamEngine.java:506) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processStream(PDFStreamEngine.java:478) > at > org.apache.pdfbox.contentstream.PDFStreamEngine.processPage(PDFStreamEngine.java:156) > at org.apache.pdfbox.rendering.PageDrawer.drawPage(PageDrawer.java:258) > at > org.apache.pdfbox.rendering.PDFRenderer.renderImage(PDFRenderer.java:225) > at > org.apache.pdfbox.rendering.PDFRenderer.renderImageWithDPI(PDFRenderer.java:164) > {noformat} -- This message was sent by Atlassian JIRA (v7.6.3#76005) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org