The only thing I find surprising is that the old copies don't hang. It is a well known issue that when you touch AWT the Event Threads start and the only way to close the app is to call System.exit(0).
Is it perhaps the case that older copies of FO called System.exit, but someone removed it? (probably because the application terminates cleanly when it doesn't touch SVG and hence AWT)
Glen Mazza wrote:
Using the <svg> elements within an fo:instream-foreign-object is causing my work computer to having hanging threads (everything works fine at my home computer though). I'm concerned others may be getting this hanging thread problem on their machines.
Results of the below FO (work computer): 0.20.5 release: works fine (1-yr. old Batik) 0.20.x nightly: hangs (Batik updated one month ago, due to API changes) 1.0 dev: hangs (Batik version of two weeks ago, also with nightly build)
All three still generate a correct PDF document w/SVG,
even though the app hangs (I just need to Ctrl-C to
Here's the FO:
<?xml version="1.0" encoding="UTF-8"?> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> <fo:layout-master-set> <fo:simple-page-master master-name="simpleA4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm" margin-right="2cm"> <fo:region-body/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="simpleA4"> <fo:flow flow-name="xsl-region-body"> <fo:block font-size="16pt" font-weight="bold" space-after="5mm">Test FO w/SVG
<fo:instream-foreign-object> <svg:svg width="20" height="20" xml:space="preserve"> <svg:g style="fill:red; stroke:#000000"> <svg:rect x="0" y="0" width="15" height="15"/> <svg:rect x="5" y="5" width="15" height="15"/> </svg:g> </svg:svg> </fo:instream-foreign-object>
</fo:flow> </fo:page-sequence> </fo:root>
Running this at work without the <svg> (i.e., just an empty <fo:instream-foreign-object> causes this to run fine. As soon as I add any SVG elements in though, the hanging occurs.
(1) Will someone please run the above FO on a recent 1.0 build and let me know whether it exits cleanly on your machine?
(2) Just before FOP exits (in FOP.java) I put in some debug statements to determine the thread counts:
(run without SVG--no hanging):
[INFO] 1.0dev index = 0 Thread = Thread[main,5,main]
(run with SVG included--hanging):
index = 0 Thread = Thread[main,5,main] index = 1 Thread = Thread[AWT-EventQueue-0,6,main] index = 2 Thread = Thread[SunToolkit.PostEventQueue-0,6,main] index = 3 Thread = Thread[AWT-Windows,6,main] index = 4 Thread = Thread[EventQueueMonitor-ComponentEvtDispatch,5,main] index = 5 Thread = Thread[Thread-1,5,main] index = 6 Thread = Thread[Thread-2,5,main]
In the (unlikely?) event others are getting hanging threads w/the FO above, looking at the names of the threads above, is the hanging probably occuring with Batik threads or within FOP? I don't believe we're running multithreaded here--but am unsure where the problem is.
__________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com