You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Ingo Maas <in...@ebp.de> on 2008/09/08 17:43:08 UTC

Font autodetection yields Out-of-Memory error

Hallo,

 

In font autodetection seems to be a bug, introduced sometime in June/July. I
hoped that this has been fixed in 0.95 or current trunk, but it has not. See
stacktrace for current trunk below.

 

Regards, Ingo 

 

Stacktrace: java.lang.OutOfMemoryError: Java heap space

      at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)

      at java.lang.AbstractStringBuilder.append(Unknown Source)

      at java.lang.StringBuffer.append(Unknown Source)

      at
org.apache.fop.fonts.type1.PFMInputStream.readString(PFMInputStream.java:102
)

      at org.apache.fop.fonts.type1.PFMFile.loadHeader(PFMFile.java:135)

      at org.apache.fop.fonts.type1.PFMFile.load(PFMFile.java:108)

      at
org.apache.fop.fonts.type1.Type1FontLoader.read(Type1FontLoader.java:102)

      at org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:171)

      at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:120)

      at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:98)

      at
org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:251)

<cut>…<cut/>

 

-- 

Ernst Basler + Partner GmbH
Ingo Maas
Tuchmacherstraße 47
DE-14482 Potsdam

 

+49 331 74 75 9 0  (Zentrale)
+49 331 74 75 9 78 (Direkt)
+49 331 74 75 9 90 (Fax) 

 

Geschäftsführer: Dr. Ludger Paus
Amtsgericht Potsdam - HRB 6362 P
USt-Id Nr. 152768391

 

 <ma...@ebp.de> mailto:Ingo.Maas@ebp.de
 <http://www.ebp.de> http://www.ebp.de

 

 

 


AW: AW: Font autodetection yields Out-of-Memory error

Posted by Ingo Maas <in...@ebp.de>.
Hi Jeremias,

if the loop condition in PFMInputStream.readString() only checks for 0
(zero) as a terminator then that loop 'll run forever if the (last) zero
before EOF is missing. It 'll read EOF characters again and again increasing
the StringBuffer char by char until infinity, once terminated in the case of
lacking any more memory for the StringBuffer.

I don't know, if the missing zero is outside of the specs, but FOP can (and
should IMHO) care a little more at this point.

Greetings, Ingo

-----Ursprüngliche Nachricht-----
Von: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Gesendet: Dienstag, 9. September 2008 13:16
An: fop-users@xmlgraphics.apache.org
Betreff: Re: AW: Font autodetection yields Out-of-Memory error

Please note that an OutOfMemoryError can occur anywhere. A stack trace
in such a case is not an reliable indicator for a problem.

I don't think there's a problem with any specific font. PFM files are
rarely larger than a couple of kilobytes. I'd rather increase the heap
size (as a work-around) or start up a profiler to find out who exactly
uses so much memory (or rather doesn't release it in time). FOP's font
handling is known to be a bit memory-hungry. I've experienced an
OutOfMemoryError myself occasionally during font auto-detection but so
far I haven't been able put my finger on it.

Ingo, you can generate a heap dump if you add the following VM
parameter:
-XX:+HeapDumpOnOutOfMemoryError
The generated file can then be used to figure out memory problems with
the right tools (like IBM's Heap Analyzer or YourKit). If you want you
can put it somewhere on a server and send me a link. I can then take a
look. Don't send those files by mail: they are huge!

On 09.09.2008 11:41:20 Ingo Maas wrote:
> Hi Adrian,
> 
> the fonts are original Adobe fonts, which I took for tests from older
> Acrobat Reader. Therefore, they are trustworthy, at least more than those
> Ghostscript fonts, which have failed for me in metrics generation.
> 
> Having a look at PFMInputStream.readString(), it is evident what is going
> wrong. The stream only catches zero terminations but not EOF (i.e. -1).
> Wouldn't make it sense to catch EOF here as well?
> 
> Greetings, Ingo
> 
> -----Ursprüngliche Nachricht-----
> Von: Adrian Cumiskey [mailto:adrian.cumiskey@gmail.com] 
> Gesendet: Montag, 8. September 2008 18:15
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: Font autodetection yields Out-of-Memory error
> 
> Hi Ingo,
> 
> Looking at the stack trace it doesn't look to be a problem with font
> autodetection, more to do with 
> a parsing problem on one of your PFM files.  I'm guessing it must be an
> erroneous one as I wasn't 
> able to reproduce the problem with the PFM font file that I tried.
> 
> Could you try isolating which PFM file is the offending one?  You should
be
> able to see which font 
> file is causing you the problem by changing your LOGLEVEL variable towards
> the bottom of your fop 
> launcher file to "info" or "debug" and then relaunching.
> 
> Adrian.
> 
> Ingo Maas wrote:
> > Hallo,
> > 
> >  
> > 
> > In font autodetection seems to be a bug, introduced sometime in 
> > June/July. I hoped that this has been fixed in 0.95 or current trunk, 
> > but it has not. See stacktrace for current trunk below.
> > 
> >  
> > 
> > Regards, Ingo
> > 
> >  
> > 
> > Stacktrace: java.lang.OutOfMemoryError: Java heap space
> > 
> >       at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
> > 
> >       at java.lang.AbstractStringBuilder.append(Unknown Source)
> > 
> >       at java.lang.StringBuffer.append(Unknown Source)
> > 
> >       at 
> >
>
org.apache.fop.fonts.type1.PFMInputStream.readString(_PFMInputStream.java:10
> 2_)
> > 
> >       at
org.apache.fop.fonts.type1.PFMFile.loadHeader(_PFMFile.java:135_)
> > 
> >       at org.apache.fop.fonts.type1.PFMFile.load(_PFMFile.java:108_)
> > 
> >       at 
> >
>
org.apache.fop.fonts.type1.Type1FontLoader.read(_Type1FontLoader.java:102_)
> > 
> >       at org.apache.fop.fonts.FontLoader.getFont(_FontLoader.java:171_)
> > 
> >       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:120_)
> > 
> >       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:98_)
> > 
> >       at 
> >
>
org.apache.fop.fonts.autodetect.FontInfoFinder.find(_FontInfoFinder.java:251
> _)
> > 
> > <cut>…<cut/>
> > 
> >  
> > 
> > -- 
> > 
> > Ernst Basler + Partner GmbH
> > Ingo Maas
> > Tuchmacherstraße 47
> > DE-14482 Potsdam
> > 
> >  
> > 
> > +49 331 74 75 9 0  (Zentrale)
> > +49 331 74 75 9 78 (Direkt)
> > +49 331 74 75 9 90 (Fax)
> > 
> >  
> > 
> > Geschäftsführer: Dr. Ludger Paus
> > Amtsgericht Potsdam - HRB 6362 P
> > USt-Id Nr. 152768391
> > 
> >  
> > 
> > mailto:Ingo.Maas@ebp.de
> > http://www.ebp.de
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> 




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: AW: Font autodetection yields Out-of-Memory error

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Please note that an OutOfMemoryError can occur anywhere. A stack trace
in such a case is not an reliable indicator for a problem.

I don't think there's a problem with any specific font. PFM files are
rarely larger than a couple of kilobytes. I'd rather increase the heap
size (as a work-around) or start up a profiler to find out who exactly
uses so much memory (or rather doesn't release it in time). FOP's font
handling is known to be a bit memory-hungry. I've experienced an
OutOfMemoryError myself occasionally during font auto-detection but so
far I haven't been able put my finger on it.

Ingo, you can generate a heap dump if you add the following VM
parameter:
-XX:+HeapDumpOnOutOfMemoryError
The generated file can then be used to figure out memory problems with
the right tools (like IBM's Heap Analyzer or YourKit). If you want you
can put it somewhere on a server and send me a link. I can then take a
look. Don't send those files by mail: they are huge!

On 09.09.2008 11:41:20 Ingo Maas wrote:
> Hi Adrian,
> 
> the fonts are original Adobe fonts, which I took for tests from older
> Acrobat Reader. Therefore, they are trustworthy, at least more than those
> Ghostscript fonts, which have failed for me in metrics generation.
> 
> Having a look at PFMInputStream.readString(), it is evident what is going
> wrong. The stream only catches zero terminations but not EOF (i.e. -1).
> Wouldn't make it sense to catch EOF here as well?
> 
> Greetings, Ingo
> 
> -----Ursprüngliche Nachricht-----
> Von: Adrian Cumiskey [mailto:adrian.cumiskey@gmail.com] 
> Gesendet: Montag, 8. September 2008 18:15
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: Font autodetection yields Out-of-Memory error
> 
> Hi Ingo,
> 
> Looking at the stack trace it doesn't look to be a problem with font
> autodetection, more to do with 
> a parsing problem on one of your PFM files.  I'm guessing it must be an
> erroneous one as I wasn't 
> able to reproduce the problem with the PFM font file that I tried.
> 
> Could you try isolating which PFM file is the offending one?  You should be
> able to see which font 
> file is causing you the problem by changing your LOGLEVEL variable towards
> the bottom of your fop 
> launcher file to "info" or "debug" and then relaunching.
> 
> Adrian.
> 
> Ingo Maas wrote:
> > Hallo,
> > 
> >  
> > 
> > In font autodetection seems to be a bug, introduced sometime in 
> > June/July. I hoped that this has been fixed in 0.95 or current trunk, 
> > but it has not. See stacktrace for current trunk below.
> > 
> >  
> > 
> > Regards, Ingo
> > 
> >  
> > 
> > Stacktrace: java.lang.OutOfMemoryError: Java heap space
> > 
> >       at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
> > 
> >       at java.lang.AbstractStringBuilder.append(Unknown Source)
> > 
> >       at java.lang.StringBuffer.append(Unknown Source)
> > 
> >       at 
> >
> org.apache.fop.fonts.type1.PFMInputStream.readString(_PFMInputStream.java:10
> 2_)
> > 
> >       at org.apache.fop.fonts.type1.PFMFile.loadHeader(_PFMFile.java:135_)
> > 
> >       at org.apache.fop.fonts.type1.PFMFile.load(_PFMFile.java:108_)
> > 
> >       at 
> >
> org.apache.fop.fonts.type1.Type1FontLoader.read(_Type1FontLoader.java:102_)
> > 
> >       at org.apache.fop.fonts.FontLoader.getFont(_FontLoader.java:171_)
> > 
> >       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:120_)
> > 
> >       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:98_)
> > 
> >       at 
> >
> org.apache.fop.fonts.autodetect.FontInfoFinder.find(_FontInfoFinder.java:251
> _)
> > 
> > <cut>…<cut/>
> > 
> >  
> > 
> > -- 
> > 
> > Ernst Basler + Partner GmbH
> > Ingo Maas
> > Tuchmacherstraße 47
> > DE-14482 Potsdam
> > 
> >  
> > 
> > +49 331 74 75 9 0  (Zentrale)
> > +49 331 74 75 9 78 (Direkt)
> > +49 331 74 75 9 90 (Fax)
> > 
> >  
> > 
> > Geschäftsführer: Dr. Ludger Paus
> > Amtsgericht Potsdam - HRB 6362 P
> > USt-Id Nr. 152768391
> > 
> >  
> > 
> > mailto:Ingo.Maas@ebp.de
> > http://www.ebp.de
> > 
> >  
> > 
> >  
> > 
> >  
> > 
> 




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: AW: Font autodetection yields Out-of-Memory error

Posted by Adrian Cumiskey <ad...@gmail.com>.
Hi Ingo,

You definitely have a bad font somewhere on your system.  I have just committed a small change to 
the latest FOP code which should make the string parsing a little more robust by catching the EOF 
exception case and when an erroneous PFM file is encountered.  Hopefully you will be able to locate 
the offending font now.

Adrian.

Ingo Maas wrote:
> Hi Adrian,
> 
> the fonts are original Adobe fonts, which I took for tests from older
> Acrobat Reader. Therefore, they are trustworthy, at least more than those
> Ghostscript fonts, which have failed for me in metrics generation.
> 
> Having a look at PFMInputStream.readString(), it is evident what is going
> wrong. The stream only catches zero terminations but not EOF (i.e. -1).
> Wouldn't make it sense to catch EOF here as well?
> 
> Greetings, Ingo
> 
> -----Ursprüngliche Nachricht-----
> Von: Adrian Cumiskey [mailto:adrian.cumiskey@gmail.com] 
> Gesendet: Montag, 8. September 2008 18:15
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: Font autodetection yields Out-of-Memory error
> 
> Hi Ingo,
> 
> Looking at the stack trace it doesn't look to be a problem with font
> autodetection, more to do with 
> a parsing problem on one of your PFM files.  I'm guessing it must be an
> erroneous one as I wasn't 
> able to reproduce the problem with the PFM font file that I tried.
> 
> Could you try isolating which PFM file is the offending one?  You should be
> able to see which font 
> file is causing you the problem by changing your LOGLEVEL variable towards
> the bottom of your fop 
> launcher file to "info" or "debug" and then relaunching.
> 
> Adrian.
> 
> Ingo Maas wrote:
>> Hallo,
>>
>>  
>>
>> In font autodetection seems to be a bug, introduced sometime in 
>> June/July. I hoped that this has been fixed in 0.95 or current trunk, 
>> but it has not. See stacktrace for current trunk below.
>>
>>  
>>
>> Regards, Ingo
>>
>>  
>>
>> Stacktrace: java.lang.OutOfMemoryError: Java heap space
>>
>>       at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
>>
>>       at java.lang.AbstractStringBuilder.append(Unknown Source)
>>
>>       at java.lang.StringBuffer.append(Unknown Source)
>>
>>       at 
>>
> org.apache.fop.fonts.type1.PFMInputStream.readString(_PFMInputStream.java:10
> 2_)
>>       at org.apache.fop.fonts.type1.PFMFile.loadHeader(_PFMFile.java:135_)
>>
>>       at org.apache.fop.fonts.type1.PFMFile.load(_PFMFile.java:108_)
>>
>>       at 
>>
> org.apache.fop.fonts.type1.Type1FontLoader.read(_Type1FontLoader.java:102_)
>>       at org.apache.fop.fonts.FontLoader.getFont(_FontLoader.java:171_)
>>
>>       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:120_)
>>
>>       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:98_)
>>
>>       at 
>>
> org.apache.fop.fonts.autodetect.FontInfoFinder.find(_FontInfoFinder.java:251
> _)
>> <cut>…<cut/>
>>
>>  
>>
>> -- 
>>
>> Ernst Basler + Partner GmbH
>> Ingo Maas
>> Tuchmacherstraße 47
>> DE-14482 Potsdam
>>
>>  
>>
>> +49 331 74 75 9 0  (Zentrale)
>> +49 331 74 75 9 78 (Direkt)
>> +49 331 74 75 9 90 (Fax)
>>
>>  
>>
>> Geschäftsführer: Dr. Ludger Paus
>> Amtsgericht Potsdam - HRB 6362 P
>> USt-Id Nr. 152768391
>>
>>  
>>
>> mailto:Ingo.Maas@ebp.de
>> http://www.ebp.de
>>
>>  
>>
>>  
>>
>>  
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


AW: Font autodetection yields Out-of-Memory error

Posted by Ingo Maas <in...@ebp.de>.
Hi Adrian,

the fonts are original Adobe fonts, which I took for tests from older
Acrobat Reader. Therefore, they are trustworthy, at least more than those
Ghostscript fonts, which have failed for me in metrics generation.

Having a look at PFMInputStream.readString(), it is evident what is going
wrong. The stream only catches zero terminations but not EOF (i.e. -1).
Wouldn't make it sense to catch EOF here as well?

Greetings, Ingo

-----Ursprüngliche Nachricht-----
Von: Adrian Cumiskey [mailto:adrian.cumiskey@gmail.com] 
Gesendet: Montag, 8. September 2008 18:15
An: fop-users@xmlgraphics.apache.org
Betreff: Re: Font autodetection yields Out-of-Memory error

Hi Ingo,

Looking at the stack trace it doesn't look to be a problem with font
autodetection, more to do with 
a parsing problem on one of your PFM files.  I'm guessing it must be an
erroneous one as I wasn't 
able to reproduce the problem with the PFM font file that I tried.

Could you try isolating which PFM file is the offending one?  You should be
able to see which font 
file is causing you the problem by changing your LOGLEVEL variable towards
the bottom of your fop 
launcher file to "info" or "debug" and then relaunching.

Adrian.

Ingo Maas wrote:
> Hallo,
> 
>  
> 
> In font autodetection seems to be a bug, introduced sometime in 
> June/July. I hoped that this has been fixed in 0.95 or current trunk, 
> but it has not. See stacktrace for current trunk below.
> 
>  
> 
> Regards, Ingo
> 
>  
> 
> Stacktrace: java.lang.OutOfMemoryError: Java heap space
> 
>       at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
> 
>       at java.lang.AbstractStringBuilder.append(Unknown Source)
> 
>       at java.lang.StringBuffer.append(Unknown Source)
> 
>       at 
>
org.apache.fop.fonts.type1.PFMInputStream.readString(_PFMInputStream.java:10
2_)
> 
>       at org.apache.fop.fonts.type1.PFMFile.loadHeader(_PFMFile.java:135_)
> 
>       at org.apache.fop.fonts.type1.PFMFile.load(_PFMFile.java:108_)
> 
>       at 
>
org.apache.fop.fonts.type1.Type1FontLoader.read(_Type1FontLoader.java:102_)
> 
>       at org.apache.fop.fonts.FontLoader.getFont(_FontLoader.java:171_)
> 
>       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:120_)
> 
>       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:98_)
> 
>       at 
>
org.apache.fop.fonts.autodetect.FontInfoFinder.find(_FontInfoFinder.java:251
_)
> 
> <cut>…<cut/>
> 
>  
> 
> -- 
> 
> Ernst Basler + Partner GmbH
> Ingo Maas
> Tuchmacherstraße 47
> DE-14482 Potsdam
> 
>  
> 
> +49 331 74 75 9 0  (Zentrale)
> +49 331 74 75 9 78 (Direkt)
> +49 331 74 75 9 90 (Fax)
> 
>  
> 
> Geschäftsführer: Dr. Ludger Paus
> Amtsgericht Potsdam - HRB 6362 P
> USt-Id Nr. 152768391
> 
>  
> 
> mailto:Ingo.Maas@ebp.de
> http://www.ebp.de
> 
>  
> 
>  
> 
>  
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Font autodetection yields Out-of-Memory error

Posted by Adrian Cumiskey <ad...@gmail.com>.
Hi Ingo,

Looking at the stack trace it doesn't look to be a problem with font autodetection, more to do with 
a parsing problem on one of your PFM files.  I'm guessing it must be an erroneous one as I wasn't 
able to reproduce the problem with the PFM font file that I tried.

Could you try isolating which PFM file is the offending one?  You should be able to see which font 
file is causing you the problem by changing your LOGLEVEL variable towards the bottom of your fop 
launcher file to "info" or "debug" and then relaunching.

Adrian.

Ingo Maas wrote:
> Hallo,
> 
>  
> 
> In font autodetection seems to be a bug, introduced sometime in 
> June/July. I hoped that this has been fixed in 0.95 or current trunk, 
> but it has not. See stacktrace for current trunk below.
> 
>  
> 
> Regards, Ingo
> 
>  
> 
> Stacktrace: java.lang.OutOfMemoryError: Java heap space
> 
>       at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
> 
>       at java.lang.AbstractStringBuilder.append(Unknown Source)
> 
>       at java.lang.StringBuffer.append(Unknown Source)
> 
>       at 
> org.apache.fop.fonts.type1.PFMInputStream.readString(_PFMInputStream.java:102_)
> 
>       at org.apache.fop.fonts.type1.PFMFile.loadHeader(_PFMFile.java:135_)
> 
>       at org.apache.fop.fonts.type1.PFMFile.load(_PFMFile.java:108_)
> 
>       at 
> org.apache.fop.fonts.type1.Type1FontLoader.read(_Type1FontLoader.java:102_)
> 
>       at org.apache.fop.fonts.FontLoader.getFont(_FontLoader.java:171_)
> 
>       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:120_)
> 
>       at org.apache.fop.fonts.FontLoader.loadFont(_FontLoader.java:98_)
> 
>       at 
> org.apache.fop.fonts.autodetect.FontInfoFinder.find(_FontInfoFinder.java:251_)
> 
> <cut>…<cut/>
> 
>  
> 
> -- 
> 
> Ernst Basler + Partner GmbH
> Ingo Maas
> Tuchmacherstraße 47
> DE-14482 Potsdam
> 
>  
> 
> +49 331 74 75 9 0  (Zentrale)
> +49 331 74 75 9 78 (Direkt)
> +49 331 74 75 9 90 (Fax)
> 
>  
> 
> Geschäftsführer: Dr. Ludger Paus
> Amtsgericht Potsdam - HRB 6362 P
> USt-Id Nr. 152768391
> 
>  
> 
> mailto:Ingo.Maas@ebp.de
> http://www.ebp.de
> 
>  
> 
>  
> 
>  
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org