I have a application that sends out a few 100k emails each night, so to speed processing added some cfthreads.
This has caused some strange errors, and I've found that a variable created in one thread is being modified by another thread. From the documentation I've read, variables created in one thread should be visible only to that thread?
Made a simple test like so:
<cfthread
name="thread1"
action="run">
<cfsavecontent variable="local.template_body">
<cfinclude template="templates\6\2\bulletin_template.cfm">
</cfsavecontent>
<cfset tmpEmailBody = template_body>
</cfthread>
<cfthread
name="thread2"
action="run">
<cffile action="append"
file="C:\inetpub\error1.txt"
output="#tmpEmailBody#">
</cfthread>
The contents of "tmpEmailBody" successfully get written to the file.
The strange thing is if i remove the cfsavecontent section, and have:
<cfset tmpEmailBody = "test">
, then the second thread raises and error that tmpEmailBody isnt defined, as I would expect.
Anyone know what's going on here?