Re: cfthreads, scopes, cfreport and JVM memory.
Yes there is a thread local scope and one can use the 'Var' keyword, but apparently it is somewhat unnecessary. So this just leaves me trying to control the memory used by the cfreport... tag. Instead of writing directly to a file I am putting the cfreport... output into a variable and then attempting to write that file out. This seems to be working for the memory now, the memory is released and cleaned up between each batch during the sleep period to the throttle the report generation. But the files are not actually being written! Should this work? BUILD REPORT --- cfreport template=ren.cfr format=pdf overwrite=yes name=vReportLetter cfreportparam name=pFirmNo value=#ResultFirms[firmno][threadIndex]# cfreportparam name=pIssueDate value=#DateFormat(pIssueDate, 'mm/dd/yy')# cfreportparam name=pRenewalId value=#vRenewalSeq# /cfreport cfset arrayAppend(variables.pdfFiles,vOutputFilePath) cfpdf action=write source=#vReportLetter# destination=#vOutputFilePath# overwrite=yes Or do I just use a cffile action=write... tag. Isn't that just for text files or can I write out binary output like a PDF file? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307668 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: cfthreads, scopes, cfreport and JVM memory.
Ian, First... I would var any variables used inside the thread. Second, you should be able to write this file using cffile - but I'm not sure why your cfpdf action is not working. But you want to try this code outside your cfthread to see how it behaves - cfthread obscures error information and makes it difficult to troubleshoot :) -mark Mark A. Kruger, CFG, MCSE (402) 408-3733 ext 105 www.cfwebtools.com www.coldfusionmuse.com www.necfug.com -Original Message- From: Ian Skinner [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 18, 2008 10:45 AM To: CF-Talk Subject: Re: cfthreads, scopes, cfreport and JVM memory. Yes there is a thread local scope and one can use the 'Var' keyword, but apparently it is somewhat unnecessary. So this just leaves me trying to control the memory used by the cfreport... tag. Instead of writing directly to a file I am putting the cfreport... output into a variable and then attempting to write that file out. This seems to be working for the memory now, the memory is released and cleaned up between each batch during the sleep period to the throttle the report generation. But the files are not actually being written! Should this work? BUILD REPORT --- cfreport template=ren.cfr format=pdf overwrite=yes name=vReportLetter cfreportparam name=pFirmNo value=#ResultFirms[firmno][threadIndex]# cfreportparam name=pIssueDate value=#DateFormat(pIssueDate, 'mm/dd/yy')# cfreportparam name=pRenewalId value=#vRenewalSeq# /cfreport cfset arrayAppend(variables.pdfFiles,vOutputFilePath) cfpdf action=write source=#vReportLetter# destination=#vOutputFilePath# overwrite=yes Or do I just use a cffile action=write... tag. Isn't that just for text files or can I write out binary output like a PDF file? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307677 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: cfthreads, scopes, cfreport and JVM memory.
Mark Kruger wrote: Ian, First... I would var any variables used inside the thread. Second, you should be able to write this file using cffile - but I'm not sure why your cfpdf action is not working. But you want to try this code outside your cfthread to see how it behaves - cfthread obscures error information and makes it difficult to troubleshoot :) -mark Yeah, that finally tracked down the problem to incorrect pound signs in the cfpdf... tag. The source parameter just needs that string of the the PDF variable not to process it as a variable. That is one of the inconsistencies of CF that trips me up most often. When to just use the string of the variable and when not to in tag parameters. Now I am struggling with how threads and memory usage work together. I think I may be bouncing around a bug, at least some type of unexpected (for me at least) behavior. So far it seems to center around writing PDF content to files. When I straightened out the cfpdf... tag, so that it works correctly, I am again experiencing the phenomenon where JVM memory usage will just climb and climb with each iteration of PDF generation until the master thread is finished or the memory is full and CF starts throwing exceptions. The same thing happened when the cfreport... tag directly wrote the PDF content it generates to a file. The whole point of this is the create ~1300 multiple page pdf form letters that we know will not all fit into memory at once. How can we control this so that the process can be allowed to finish? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307680 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cfthreads, scopes, cfreport and JVM memory.
Hi Ian You say that you are throttling the process to create a pause between batches. Is your throttle part of the function that creates the threads? (Given that you say that memory isn't released until this function completes, this probably wouldn't help.) Look at things another way - if cfthread didn't exist, you would probably be using cfschedule to throttle the process - ie create PDFs 1 - 20, then 21 - 40, and so on. Can you cfschedule your function (that creates all 1300 threads) in batches, so that this function has a chance to complete (and theoretically release the memory that it's threads consume)? Still use threads within this function, but if you only process 20 threads at a time, this might help. Antony On Thu, Jun 19, 2008 at 5:04 AM, Ian Skinner [EMAIL PROTECTED] wrote: The whole point of this is the create ~1300 multiple page pdf form letters that we know will not all fit into memory at once. How can we control this so that the process can be allowed to finish? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;203748912;27390454;j Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:307699 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4