Exhaustion of file handles query ...

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Exhaustion of file handles query ...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:58 pm

by Silversprings >> Tue, 28 Mar 2006 4:26:34 GMT

Hi Tech. Gennys,

When I create a report class instance to work with for outputting a report (eg. "create invRep transient;") I always delete the report instance with a "delete invRep" in the epilog of the method that created it.

However if you call this method from within a loop that is say, processing customers then I found that after processing about 70 customers the system would either freeze up or present an error that made me suspect that resources like file handles were being used up to the point of exhaustion and not released after each customer had been reported.

This was confirmed by changing the code so that only one report instance was created and that all controls on it were initialised on it each time round the loop for processing each customer. Now the report processing works "sweet as" ....

Well not quite because I resent having the performance hit of having to clear control settings on the report instance each time round the loop instead of just having it deleted and using the default settings if a new instance is created.

So, is this a bug in JADE that the file handle resources are not being released when a "delete invRep" statement is executed ????????????????????????????????

regards

SilverSprings ........... ______________________________________________________

Alan J.Thomson
JADE Consultant, Endeavour Solutions Ltd
Tel (09) 366 2130
www.endeavour.co.nz

This message and any attachments are intended for the addressee only and may contain confidential or privileged information. Any unauthorised copying, disclosure, retention or distribution of this material is forbidden. Any views expressed are those of the individual sender.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Exhaustion of file handles query ...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:58 pm

by cnwjhp1 >> Tue, 28 Mar 2006 5:21:02 GMT

We had a similar problem, running out of GDI memory for forms. Turns out transient forms are only actually deleted in Jade's idle loop, and are only queued when you do the delete. We solved it by exiting to the timer loop between reports, to allow the form to be deleted. Don't know if an app.doWindowEvents(0) would be sufficient.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Exhaustion of file handles query ...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:58 pm

by Torrie >> Tue, 28 Mar 2006 5:34:49 GMT

Any chance the error was a 14063 exception? Jade only deletes a form when a "quiet point" is reached. See the "14063 Window Create Failed Exception" thread in the Tech Tip Techniques group. The support desk has posted a couple of possible solutions.

As for the performance hit, it probably is a lot faster to reuse the existing report as you don't have to go through the overhead of creating the report, initializing all the controls , marking it for deletion. If you are printing to a text file then it is probably better just to write to the file rather than to use a report.

Torrie

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Exhaustion of file handles query ...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:59 pm

by Patwos >> Tue, 28 Mar 2006 9:27:00 GMT

As others have already stated, the forms are deleted when next idle so the GDI resource used by create invRep transient will eventually cause windows to run out of available GDI resources. Using createPrintForm instead prevents the GDI resources from being exhausted.

As regards a performance hit, a quick test of a 1000 page report with 6 print frames and 40 label controls shows the following timings:

One form, reset data on all labels for each print page: 31 seconds Multiple forms created via createPrintForm: 34 seconds.

As Torrie surmised, it's actually faster with this test to reuse the form, although the time difference is so negligible with my test form it really makes little difference either way. You may of course find different timings with your form layout etc.

Hope that helps,
Pat.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Exhaustion of file handles query ...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:59 pm

by Silversprings >> Fri, 31 Mar 2006 4:16:30 GMT

Hi
Yes, changing creation of report forms to work with to repForm := repFormClass.createPrintForm is an improvement and one that I'll use from now on instead of "create repForm transient").

Also I changed my code to setup just the one report form and now call a method to clear the contents of the labels etc between customers being processed and this did the trick. Now I can report on any number of customers without running out of resources.

However, this is not as neat and tidy as creating and deleting the report form for each customer but I guess we'll just have to settle for this "kludge" for now ...

cheers
Silversprings .................................

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Exhaustion of file handles query ...

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:59 pm

by Dr J. >> Sat, 1 Apr 2006 6:49:36 GMT

I'd hardly call it a "kludge" writing the report to reuse the form rather than creating a fresh form for each customer. Some reports actually benefit from this style of output, such as reports where the header and footer information is the same throughout the report and therefore needs to be setup only once at the beginning of the report rather than repeatedly setting it for each new page.

If you do use createPrintForm in preference to reusing the forms, then the only difference in your report is the syntax of the create statement that is used. The rest of your report would be the same as it was for the original create statement.

Finally, remember that it is only a preference that you want to create fresh forms for each customer. That does not make reusing a form a "kludge" or undesirable way of producing the report, it just makes it a perfectly valid alternative option for producing reports. :)


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 36 guests