pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tilman Hausherr (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PDFBOX-4219) Multithreading problem when rendering several documents with Standard 14 fonts
Date Fri, 11 May 2018 09:36:00 GMT

     [ https://issues.apache.org/jira/browse/PDFBOX-4219?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tilman Hausherr updated PDFBOX-4219:
------------------------------------
    Description: 
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 KINGSTON usb stick.

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}


  was:
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.

My theory is that one thread accesses the naming table and another accesses the glyf table.
I did try 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 KINGSTON usb stick.

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}



> 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 KINGSTON usb stick.
> 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-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message