Bug 4965 - FOP rendering svg to pdf is never ending and has a memory leakage.
Summary: FOP rendering svg to pdf is never ending and has a memory leakage.
Status: CLOSED INVALID
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: svg (show other bugs)
Version: all
Hardware: PC All
: P3 normal
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-20 02:57 UTC by hans-peter.stauffer
Modified: 2012-04-01 13:53 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hans-peter.stauffer 2001-11-20 02:57:00 UTC
FOP V0.20.1 is never ending, when using in JDK 1.3.02, rendering xml:fo that 
contains svg to pdf. The dokument will be created correctly, the debugging 
output seems ok, the main task ends. However, it seems like there are some 
hanging tasks in background, as the application is never ending. There is also 
a memory leakage of about 1KByte.

used System: W2000 Prof.

debugging output:

    using SAX parser org.apache.xerces.parsers.SAXParser
    building formatting object tree
    setting up fonts
     [1]
     [2]
     [3]
     [4] [5] [6] [7] [8] [9] [10>]
    Parsing of document complete, stopping renderer
    Initial heap size: 1528Kb
    Current heap size: 6282Kb
    Total memory used: 4754Kb
      Memory use is indicative; no GC was performed
      These figures should not be used comparatively
    Total time used: 16063ms
    Pages rendererd: 10
    Avg render time: 1606ms/page



xsl:fo the file is very large (164 kByte). The part that produces the bug is:

<svg xmlns="http://www.w3.org/2000/svg" height="415" width="710" style="font-
family:Helvetica, Arial">
	<rect style="fill:#FFFFFF; stroke:#000080; stroke-width:1" height="415" 
width="710" y="0" x="0"/>
	<g transform="scale(0.75)">
		<text y="40" x="200" style="font-family:Helvetica; font-
size:20pt; font-weight:normal; text-anchor:middle; stroke:none">Anlagegruppen
					 		</text>
		<text y="70" x="200" style="font-size:16; font-weight:normal; 
text-anchor:middle">[% vom Gesamtvermögenswert]
							</text>
		<rect height="120" width="260" y="15" x="-30" 
style="fill:#F0F0F0; stroke:black; stroke-width:1" transform="translate(100, 
400)"/>
		<path d="M 130 0 A 130 130 0 0 0          
118.84933694241413          -52.676703658719155          L 0 0 L 130 0" 
transform="translate(200, 250) rotate(0)" style="fill:#000080; stroke:black; 
stroke-width:1"/>
		<g transform="translate(100, 425)">
			<rect style="fill:#000080; stroke:black; stroke-
width:1" height="15" width="25" y="0" x="0"/>
			<text y="15" x="35" style="font-weight:normal; font-
size:16; text-anchor:start; stroke:none; fill:black">Bonds:  6,64 %</text>
		</g>
		<path d="M 130 0 A 130 130 0 1 0          
62.34146828112265          114.07690972564859          L 0 0 L 130 0" 
transform="translate(200, 250) rotate(-23.90461849802542)" style="fill:#FFCC00; 
stroke:black; stroke-width:1"/>
		<g transform="translate(100, 450)">
			<rect style="fill:#FFCC00; stroke:black; stroke-
width:1" height="15" width="25" y="0" x="0"/>
			<text y="15" x="35" style="font-weight:normal; font-
size:16; text-anchor:start; stroke:none; fill:black">Shares:  82,96 %</text>
		</g>
		<path d="M 130 0 A 130 130 0 0 0          
129.99743391129783          -0.8168087155226637          L 0 0 L 130 0" 
transform="translate(200, 250) rotate(-322.5611713504395)" style="fill:#FF3333; 
stroke:black; stroke-width:1"/>
		<g transform="translate(100, 475)">
			<rect style="fill:#FF3333; stroke:black; stroke-
width:1" height="15" width="25" y="0" x="0"/>
			<text y="15" x="35" style="font-weight:normal; font-
size:16; text-anchor:start; stroke:none; fill:black">Precious metals:  0,1 %
</text>
		</g>
		<path d="M 130 0 A 130 130 0 0 0          
103.71327714001423          -78.3808404195732          L 0 0 L 130 0" 
transform="translate(200, 250) rotate(-322.9061082763283)" style="fill:#66FF66; 
stroke:black; stroke-width:1"/>
		<g transform="translate(100, 500)">
			<rect style="fill:#66FF66; stroke:black; stroke-
width:1" height="15" width="25" y="0" x="0"/>
			<text y="15" x="35" style="font-weight:normal; font-
size:16; text-anchor:start; stroke:none; fill:black">Money Market:  10,3 %
</text>
		</g>
	</g>
	<g transform="scale(0.75) translate(550, 0)">
		<text y="40" x="175" style="font-size:20; font-weight:normal; 
text-anchor:middle">Nettovermögen nach Währung					
		</text>
		<text y="70" x="175" style="font-size:16; font-weight:normal; 
text-anchor:middle">[% vom Gesamtvermögenswert]
							</text>
		<g transform="translate(0, 100)">
			<g style="fill:#F0F0F0; stroke:black; stroke-width:1">
				<path d="M 0 0 L 0 300 L 350 300 L 350 0 L 0 0 
Z"/>
			</g>
			<g style="fill:none; stroke:#666666; stroke-width:1; 
stroke-dasharray:2 4">
				<path d="M 70 0 L 70 305 Z"/>
				<path d="M 140 0 L 140 305 Z"/>
				<path d="M 210 0 L 210 305 Z"/>
				<path d="M 280 0 L 280 305 Z"/>
			</g>
			<g style="font-size:16; text-anchor:middle">
				<text y="320" x="0">0 %</text>
				<text y="320" x="70">20 %</text>
				<text y="320" x="140">40 %</text>
				<text y="320" x="210">60 %</text>
				<text y="320" x="280">80 %</text>
				<text y="320" x="350">100 %</text>
			</g>
			<g transform="translate(0, 26)">
				<rect style="fill:#000080; stroke:black; stroke-
width:1" height="30" width="181.58" y="0" x="0"/>
				<text style="font-weight:normal; font-size:16; 
text-anchor:start; stroke:none" y="-5" x="5">CHF: 
									51,88
									 %
								</text>
			</g>
			<g transform="translate(0, 26)">
				<rect style="fill:#FFCC00; stroke:black; stroke-
width:1" height="30" width="47.25" y="60" x="0"/>
				<text style="font-weight:normal; font-size:16; 
text-anchor:start; stroke:none" y="55" x="5">USD: 
									13,5
									 %
								</text>
			</g>
			<g transform="translate(0, 26)">
				<rect style="fill:#FF3333; stroke:black; stroke-
width:1" height="30" width="57.22500000000001" y="120" x="0"/>
				<text style="font-weight:normal; font-size:16; 
text-anchor:start; stroke:none" y="115" x="5">EUR: 
									16,35
									 %
								</text>
			</g>
			<g transform="translate(0, 26)">
				<rect style="fill:#66FF66; stroke:black; stroke-
width:1" height="30" width="56.279999999999994" y="180" x="0"/>
				<text style="font-weight:normal; font-size:16; 
text-anchor:start; stroke:none" y="175" x="5">GBP: 
									16,08
									 %
								</text>
			</g>
			<g transform="translate(0, 26)">
				<rect style="fill:grey; stroke:black; stroke-
width:1" height="30" width="7.665" y="240" x="0"/>
				<text style="font-weight:normal; font-size:16; 
text-anchor:start; stroke:none" y="235" x="5">JPY: 
									2,19
									 %
								</text>
			</g>
			<g style="stroke-width:3; stroke:black">
				<path d="M 0 0 L 0 300 L 350 300 L 0 300 Z"/>
			</g>
		</g>
	</g>
</svg>

the java methods:

    public static void renderPDF(String foFile, String pdfFile) {
        try {
            // create Parser
            XMLReader parser = createParser();
            setParserFeatures(parser);
            InputStream inFo = new BufferedInputStream(new FileInputStream
(foFile));
            InputSource is = new InputSource(inFo);
            OutputStream  os = new BufferedOutputStream(new FileOutputStream
(pdfFile));
            internalRenderPDF(parser,is,os);
            os.close();
      //      System.exit(0);
        }
	catch (Exception e) {
            System.out.println("PdfProcessor failed: " + e);
        }
    }

    protected static void internalRenderPDF(XMLReader parser, InputSource 
source, OutputStream os) throws Exception{
        try{
            org.apache.fop.apps.Driver driver = new Driver();
            driver.setRenderer(Driver.RENDER_PDF);
            driver.setupDefaultMappings();
            driver.setOutputStream(os);
            driver.render(parser, source);
            os.flush();
        }
        catch(Exception e){
            MessageHandler.errorln("Error in internalRenderPDF: "+e);
            throw e;
        }
    }
Comment 1 keiron 2001-12-19 00:50:23 UTC
This is a java problem.
Comment 2 Glenn Adams 2012-04-01 13:53:15 UTC
batch transition to closed remaining pre-FOP1.0 resolved bugs