One more thought. Your code sets variables in the threads without var'ing
them. Possibly this could lead conditions where threads are competing. So
your simple example might be better if you did:
<cfloop index = "i" from="1" to="50">
<cfset threadList = listAppend(threadList,"batchRenew_thread#i#")>
<cfthread name="batchRenew_thread#i#" threadIndex="#i#" action="run">
<cfset var pathDate = ''/>
<cfset var vOutputFilePath = ''/>
... Any other varaibles... SP result names etc.
<cfset pathDate = #DatePart("yyyy", Now()).toString()#/>
<cfset vOutputFilePath = RENEWALS_FILE_PATH/>
<cfset vOutputFilePath &= pathDate & "\"/>
<cfset vOutputFilePath &= Trim(#ResultFirms["firmno"][threadIndex]#) &
"\"/>
<!--- CREATE OUTPUT PATH --->
<cfif DirectoryExists(#vOutputFilePath#) is False>
<cfdirectory action="create" directory=#vOutputFilePath#/>
</cfif>
<!--- FILE NAME --->
<cfset vOutputFilePath &= 'foobar.txt'>
<cffile action="write" nameconflict="overwrite"
file="#vOutputFilePath#" output="TESTING #timeFormat(now(),'hh:mm:ss:l')#">
</cfthread>
</cfloop>
This would insure those vars are not in play in the other threads.
Mark A. Kruger, CFG, MCSE
(402) 408-3733 ext 105
www.cfwebtools.com
www.coldfusionmuse.com
www.necfug.com
-----Original Message-----
From: Mark Kruger [mailto:[EMAIL PROTECTED]
Sent: Saturday, June 14, 2008 9:02 AM
To: CF-Talk
Subject: RE: JVM Tuning and <cthread>s... I'm Back
Ian,
I have tried and I cannot reproduce your results. Using your code I seem to
be able to spawn any number of threads and they all terminate gracefully.
One thing that comes to mind is that errors thrown inside of the thread are
not thrown back to the request. So they occur "silently" inside the code
block.
For example:
<cfloop index = "i" from="1" to="10">
<cfset x = y/>
</cfloop>
Throws a syntax error because "y" doesn't exist. But if you wrap it in a
cfthread:
<cfloop index = "i" from="1" to="10">
<cfthread name="batchRenew_thread#i#" threadIndex="#i#" action="run">
<Cfset x = y>
</cfthread>
</cfloop>
The error does not get thrown back to the page. Perhaps an unhandled
exception is actually hanging your threads?
-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: Friday, June 13, 2008 4:15 PM
To: CF-Talk
Subject: Re: JVM Tuning and <cthread>s... I'm Back
Mark Kruger wrote:
> Ian,
>
> I know I'm thick headed but... Why did you leave the file operations
> in there? You should eliminate that as well as a possibility.
For the sake of thoroughness, I commented out all code in the the threads...
My page not consitts of an <cfthread...> tag, several lines of CFML comments
and a closing </cfthread> tag.
I run this once and I have 50 open and hanging threads. Just like every
other time I have run this today.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:307485
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4