Bug 6395 - FOP stalls when it is executed by java application
Summary: FOP stalls when it is executed by java application
Status: CLOSED INVALID
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.20.1
Hardware: PC All
: P1 blocker
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-12 14:32 UTC by alphameta
Modified: 2012-04-01 13:53 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description alphameta 2002-02-12 14:32:02 UTC
hello, i have been working on this project and wanted to execute FOP from my 
java application and it stalls when it is executed.

it only works when i...
1.) 
execute it like this:
Runtime.getRuntime().exec("java -cp jars" +File.separator+ "fop.jar;jars" 
+File.separator+ "batik.jar;jars" +File.separator+ "xalan.jar;jars" 
+File.separator+ "xerces.jar org.apache.fop.apps.Fop temp" 
+File.separator+ "make_pdf.fo " +target_file.getText());
and after having a piriode of time in between where it does nothing.
it takes up to ten times as long as when it is executed by the batchfile
and it works perfectly from a batchfile
2.)
execute it like this:
Runtime.getRuntime().exec("java -cp jars" +File.separator+ "fop.jar;jars" 
+File.separator+ "batik.jar;jars" +File.separator+ "xalan.jar;jars" 
+File.separator+ "xerces.jar org.apache.fop.apps.Fop temp" 
+File.separator+ "make_pdf.fo " +target_file.getText()).waitFor();
and i close the window and with it the main programm and then all of a sudden 
it finishes and i get the pdf

either one is not very fine.
i need waitFor() with it and i cannot close the programm
i doubt that it lies within my programm because it is just one of many runtimes 
and it is the only one that doesn't work
Comment 1 Arnd Beissner 2002-02-12 14:56:42 UTC
I may have some related information on this:

When FOP is activated using the static main method, FOP always terminates 
execution by calling System.exit(x) - even when everything is ok. I suppose 
this is what causes the problem with exec().
Comment 2 alphameta 2002-02-12 15:12:43 UTC
my i mention once again, FOP stalls all of a sudden in the middle of the 
document it is trying to create.
both programms are still in memory and uses around 33MB and when it sometimes 
finishes it grows up to 66MB. none of the programms are terminated.
does someone have a workaround how you could implement this into a java 
application? 
Comment 3 J.Pietschmann 2002-04-22 12:02:33 UTC
The reason is probably that the stderr (or stdout) buffer is full. FOP
writes by default quite a few logging messages. You'll have to read them
or otherwise discard them. If the buffer is full,FOP hangs in an attempt
to write some log output. If the invoking java application is closed, so
are the file handles piping stderr and stdout output, and FOP resumes work.

It is recommended not to use exec() for executing FOP, look at the guidelines
how to embed FOP directly into your Java application.
Comment 4 Glenn Adams 2012-04-01 13:53:51 UTC
batch transition to closed remaining pre-FOP1.0 resolved bugs