[ https://issues.apache.org/jira/browse/PDFBOX-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12905472#action_12905472 ]
Martin Hilpert commented on PDFBOX-808: --------------------------------------- When I look at org.apache.fontbox.ttf.TTFDataStream.java: ------------- public byte[] read( int numberOfBytes ) throws IOException { byte[] data = new byte[ numberOfBytes ]; int amountRead = 0; int totalAmountRead = 0; while( (amountRead = read( data, totalAmountRead, numberOfBytes-totalAmountRead ) ) != -1 && totalAmountRead < numberOfBytes ) { totalAmountRead += amountRead; //<<<<<<< HERE !!!!!!!! //read at most numberOfBytes bytes from the stream. } return data; } ----------------- The thread dump shows totalAmountRead += amountRead as the place where it "hangs". When I look at jVisualVM's monitors, it shows 50% CPU usage (as the VM only has this 1 thread, it means that PDFBox uses 100% of 1 of the 2 cores). So this seems like an endless loop. Memory consumption slowly increases just to drop after 7 minutes (probably when the garbage collector cleans up). The file "nbrm____.ttf" is only 97 KB of size. Something seems to be broken ... > PDTrueTypeFont.loadTTF() freezes (at TTFDataStream.java:195) > ------------------------------------------------------------ > > Key: PDFBOX-808 > URL: https://issues.apache.org/jira/browse/PDFBOX-808 > Project: PDFBox > Issue Type: Bug > Components: FontBox > Affects Versions: 1.2.1 > Environment: PDFBox 1.2.1, JDK 1.6.0_21, Windows XP 32 Bit. > Reporter: Martin Hilpert > Priority: Critical > > Sometimes (not always), my app "freezes". When I look into jVisualVM thread > dump, I see this stack trace: > java.lang.Thread.State: RUNNABLE > at org.apache.fontbox.ttf.TTFDataStream.read(TTFDataStream.java:195) > at > org.apache.fontbox.ttf.TTFDataStream.readString(TTFDataStream.java:69) > at > org.apache.fontbox.ttf.TTFDataStream.readString(TTFDataStream.java:57) > at > org.apache.fontbox.ttf.PostScriptTable.initData(PostScriptTable.java:104) > at org.apache.fontbox.ttf.TTFParser.parseTTF(TTFParser.java:140) > at org.apache.fontbox.ttf.TTFParser.parseTTF(TTFParser.java:87) > at > org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.loadDescriptorDictionary(PDTrueTypeFont.java:206) > at > org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.loadTTF(PDTrueTypeFont.java:167) > at > org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.loadTTF(PDTrueTypeFont.java:143) > at > org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.loadTTF(PDTrueTypeFont.java:130) > It never returns and blocks the application from continuing. This hapend > several times now every few hours. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.