Bug 39285 - Attempt to render xml with inline image causes java.lang.OutOfMemoryError
Summary: Attempt to render xml with inline image causes java.lang.OutOfMemoryError
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: 0.91
Hardware: PC Windows XP
: P2 major
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-12 17:08 UTC by Jason Brice
Modified: 2012-04-01 07:09 UTC (History)
0 users



Attachments
xml contains inline images causes out of memory error (279.98 KB, text/xml)
2006-04-13 15:07 UTC, Jason Brice
Details
xml no inline images works fine (165.28 KB, text/xml)
2006-04-13 15:07 UTC, Jason Brice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Brice 2006-04-12 17:08:15 UTC
I've got two FO xml files that are identical except that one has two inline
images. Running ExampleFO2PDF.java breaks on the line:

// Start XSLT transformation and FOP processing
transformer.transform(src, res);

with a java.lang.OutOfMemoryError. 

This is happening in Eclipse Version: 3.1.0 with the memory cranked way up
(-vmargs -Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=128m), these are
small files (the "good" one is 166 KB -->
http://hornet.titansolutions.com/fotestgood.xml, the "bad" one is 280 KB -->
http://hornet.titansolutions.com/fotestbad.xml), so I don't believe it is the
xml files themselves that are causing the OOM exception. 

The full stack trace:
Exception in thread "main" java.lang.OutOfMemoryError
	at java.io.WinNTFileSystem.getBooleanAttributes(Native Method)
	at java.io.File.exists(File.java:702)
	at org.apache.fop.apps.FOURIResolver.resolve(FOURIResolver.java:67)
	at org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:549)
	at org.apache.fop.image.ImageFactory.loadImage(ImageFactory.java:204)
	at org.apache.fop.image.ImageLoader.loadImage(ImageLoader.java:54)
	at org.apache.fop.image.ContextImageCache.getImage(ImageFactory.java:441)
	at org.apache.fop.image.ImageFactory.getImage(ImageFactory.java:171)
	at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:64)
	at org.apache.fop.fo.FObj.processNode(FObj.java:120)
	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:290)
	at
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
	at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown
Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
	at ms.ExampleFO2PDF.convertFO2PDF(ExampleFO2PDF.java:84)
	at ms.ExampleFO2PDF.main(ExampleFO2PDF.java:138)

Regards,
Jason Brice
Comment 1 Jeremias Maerki 2006-04-13 07:26:51 UTC
The server seems to be down. I can't download the demo files.
Comment 2 Jason Brice 2006-04-13 15:07:06 UTC
Created attachment 18094 [details]
xml contains inline images causes out of memory error
Comment 3 Jason Brice 2006-04-13 15:07:59 UTC
Created attachment 18095 [details]
xml no inline images works fine
Comment 4 Jeremias Maerki 2006-04-23 10:52:11 UTC
The bug should be fixed now in FOP Trunk:
http://svn.apache.org/viewcvs?rev=396251&view=rev

While running your examples I got a ClassCastException rather than an
OutOfMemoryError because of a problem with markers in fo:static-content. Seems
to be a problem with white space before and after the blocks in the marker. I'll
take a closer look at that but I wonder why you didn't run into this. Or did you?
Comment 5 Jason Brice 2006-04-25 15:27:54 UTC
(In reply to comment #4)

No, I never got a class cast exception... just the out of memory error. I did
suspect that the OOM was a bogus error though because of how quickly it
happened. When stepping over the line in question, it only took a split second
to get the error, and yet my system showed no noticable spike in memory usage. 

I'll try the patch and follow up. Thx.
Comment 6 Glenn Adams 2012-04-01 07:09:51 UTC
batch transition pre-FOP1.0 resolved+fixed bugs to closed+fixed