Re: No Instance issue from WebPDFReports 1.0
Re: No Instance issue from WebPDFReports 1.0
- Subject: Re: No Instance issue from WebPDFReports 1.0
- From: Helge Staedtler <email@hidden>
- Date: Fri, 28 Oct 2005 13:22:49 +0200
i would put the relevant code which generates the pdf-report in a while-loop
and let it generate up to 1000 times. after each generation call the
garbagecollector of javaVM to cleanup. print out the mem-values before and
after the gc took place. if numbers do not become stable over time then the
pdf-generation-code might have a memory-leak (e.g. due to strong
references). ec.dispose() won't give you any mem back. it just sets
references to null I think, so that a garbage collection will free up the
space. but without triggering the GC you will not get memory back until the
VM itself thinks its time to run the GC.
that's basicaly the way how I debug mem-errors, calling GC manually and
looking at the numbers and repeating the process for more then 100-1000
times (depending on the memusage one call will need).
regards,
helge
Am 28.10.2005 12:25 Uhr schrieb "Koksiong" unter <email@hidden>:
> hi,
>
> i have tried to overwrite the Session.savePage(), the code is :
>
> public void savePage(WOComponent aPage)
> {
> if (aPage.name().equals("generateVehicleDeliveryListPDF") ||
> aPage.name().equals("com.secondmove.wopdfreports.PDFPage"))
> {
> // do nothing
> }
> else
> {
> super.savePage(aPage);
> }
> }
>
> besides,
> i also created a ec for pdf generation, after the creation , i called
> ec.dispose() . by right, it should dispose and free up memory?
>
> i monitored the memory status and the java process keep eat up memory and
> din even free up. and at the end , no instance exception was thrown out.
>
> may i know if i on the right way ? or is there any other way i can do to
> prevent this exception from happening.
>
> thanks for helps...
>
> rgds,
> koksiong
>
>> On Oct 24, 2005, at 7:56 PM, Koksiong wrote:
>>
>>> hi, all
>>>
>>> thanks for advices, i tried to disabled the Caching enabled in the
>>> Instance Settings, it seems solve the no instance problems. lol
>>>
>> That seems unlikely. That is the template cache, not the page cache,
>> that you adjusted. It sounds more like you are now running two
>> working instances instead of just one.
>>
>>
>>> The first generation looks alright, but following generation
>>> sometimes, it
>>> gives the Session timeout error. in the instance setting , the
>>> settings is
>>> -WOSessionTimeOut 3600. it should not timeout since it's 3600, or
>>> is there
>>> any action might trigger this error?
>>>
>>> any idea?
>>>
>> This is the exact same problem and cause as the one you described
>> before. The No Instance message results when there is only a single
>> instance running. This message results when there are multiple
>> instances running and the woadaptor tries to send the request to a
>> second instance when the first fails to respond. As you have not
>> implemented session fail over (few apps do), the second instance
>> fails to restore the session. When this happens, it generates the
>> session timeout error under the mistaken assumption that this is what
>> happened.
>>
>> Chuck
>>
>>
>>>> Just to let you know of our experience with pdf generation and memory
>>>> problems ...
>>>> We use 'apache fop' and/or 'ujac' for pdf generation, when the report
>>>> is too big to be generated in memory, we instead start the task in
>>>> another vm like :
>>>> ...
>>>> NSBundle bundle = NSBundle.bundleForClass
>>>> (UtilitairesFOXML.class);
>>>> URL url = bundle.pathURLForResourcePath("Java/FOXML.jar");
>>>> String selfJar = url.getPath();
>>>> String cmd = "/usr/bin/java -classpath "+ selfJar + "
>>>> org.apache.fop.apps.Fop -fo "+ foName +" -pdf "+ pdfName;
>>>> Process p = Runtime.getRuntime().exec(cmd);
>>>> ...
>>>>
>>>> We have no memory problem of generating the report definition (xsl-
>>>> fo)
>>>> from our wocomponent, but transforming the definition to pdf in
>>>> memory
>>>> can cause problem on big report (at least with current version of
>>>> apache's fop). That's why we had to do it externaly.
>>>>
>>>> - jfv
>>>>
>>>>
>>>> Le 05-10-24, à 13:58, Chuck Hill a écrit :
>>>>
>>>>
>>>>>
>>>>> On Oct 23, 2005, at 9:50 PM, Koksiong wrote:
>>>>>
>>>>>
>>>>>> hi,
>>>>>>
>>>>>> i am facing a critical problem using WebPDFReports 1.0.
>>>>>>
>>>>>> i used to generate quite a number of pdf daily, for each
>>>>>> generation,
>>>>>> it
>>>>>> may contain up to 80 pages. for the first generation, it always
>>>>>> works, but
>>>>>> if i continue to generate the pdf , it just gives No Instance
>>>>>> error.
>>>>>> Once
>>>>>> it occurs, i need to restart the webobject instance.
>>>>>>
>>>>>>
>>>>> Sounds like the application is running out of memory. Check the
>>>>> logs
>>>>> for "OutOfMemory".
>>>>>
>>>>>
>>>>>
>>>>>> the other modules are working except the pdf component. is it
>>>>>> because
>>>>>> the
>>>>>> number of pages generated is too big ?
>>>>>>
>>>>>>
>>>>> The problem is at least related to that. I can see from your code
>>>>> below that the response is getting saved in the page cache, that
>>>>> means
>>>>> it will hang around consuming memory for quite some time. You will
>>>>> need to return it in some other manner or override
>>>>> Session.savePage()
>>>>> to avoid this going into the page cache. I would also suggest
>>>>> creating an EC on the PDF page and discarding it after use.
>>>>>
>>>>>
>>>>> Chuck
>>>>>
>>>>>
>>>>>> please advice.
>>>>>>
>>>>>> rgds,
>>>>>> koksiong
>>>>>>
>>>>>> ps: the following are the code
>>>>>>
>>>>>> public WOActionResults goPrintAction()
>>>>>> {
>>>>>> generateVehicleDeliveryListPDF nextPage =
>>>>>> (generateVehicleDeliveryListPDF)pageWithName
>>>>>> ("generateVehicleDeliveryL
>>>>>> istPDF");
>>>>>> nextPage.setEc(ec);
>>>>>>
>>>>>> nextPage.setATransactionArray(aTransactionArray.mutableClone());
>>>>>> PDFPage pdfPage = (PDFPage)pageWithName("PDFPage");
>>>>>> HTML2PDFConvertor pdfConvertor = new
>>>>>> HTML2PDFConvertor();
>>>>>> pdfConvertor.createDocument("US
>>>>>> Letter",HTML2PDFConvertor.LandscapeOrientation);
>>>>>> pdfConvertor.setPaperSize(new PaperSize(792,612));
>>>>>> pdfConvertor.setTopMargin(5);
>>>>>> pdfConvertor.setLeftMargin(5);
>>>>>> pdfConvertor.setRightMargin(5);
>>>>>> pdfConvertor.setBottomMargin(5);
>>>>>> pdfConvertor.setPrintsVerticallyCentered(false);
>>>>>> pdfPage.setConvertor(pdfConvertor);
>>>>>>
>>>>>> pdfPage.appendComponent(nextPage);
>>>>>>
>>>>>> return pdfPage;
>>>>>> }
>>>>>>
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Webobjects-dev mailing list (email@hidden)
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> 40global-
>>>>>> village.net
>>>>>>
>>>>>> This email sent to email@hidden
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Coming in 2006 - an introduction to web applications using
>>>>> WebObjects
>>>>> and Xcode http://www.global-village.net/wointro
>>>>>
>>>>> Practical WebObjects - for developers who want to increase their
>>>>> overall knowledge of WebObjects or who are trying to solve specific
>>>>> problems.
>>>>> http://www.global-village.net/products/practical_webobjects
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Webobjects-dev mailing list (email@hidden)
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> email@hidden
>>>>>
>>>>> This email sent to email@hidden
>>>>>
>>>>>
>>>>>
>>>> http://www.freeiPods.com/?r=21419063
>>>>
>>>> __________________________________________________
>>>> Do You Yahoo!?
>>>> Tired of spam? Yahoo! Mail has the best spam protection around
>>>> http://mail.yahoo.com
>>>>
>>>>
>>>
>>
>> --
>> Coming in 2006 - an introduction to web applications using WebObjects
>> and Xcode http://www.global-village.net/wointro
>>
>> Practical WebObjects - for developers who want to increase their
>> overall knowledge of WebObjects or who are trying to solve specific
>> problems. http://www.global-village.net/products/practical_webobjects
>>
>>
>>
>>
>>
>>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Helge Städtler
- Expect and Respect.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden