I put the component in the application area so that it is common to all requests, and it includes the cfm template:
<cfcomponent output="false"> <cffunction name="run" output="false" returntype="void"> <cfset var tmp = false/> <cftry> <cfinclude template="inc.cfm"/> <cfcatch> <cffile action="append" file="#ExpandPath("error.log")#" output="ERROR: #cfcatch.message#"/> </cfcatch> </cftry> </cffunction> </cfcomponent>
The template that is included simply creates an array and checks the length of the array as it should be if it does not write the error.log file:
<cfset tmp = [ "one", "two", "three" ]/> <cfif ArrayLen(tmp) neq 3> <cffile action="append" file="#ExpandPath("error.log")#" output="Length = #ArrayLen(tmp)#"/> </cfif>
If I then run the load through it (100 simultaneous threads), I get the following items appearing in my error.log file ...
ERROR: element at position 3 of array variable "___IMPLICITARRYSTRUCTVAR0" cannot be found. Length = 0 Length = 2
Note I am using ColdFusion 9.0.1.274733 ontop for Java 1.7.0_09. I tested Railo on the same JRE and it works great.
In addition . There is also a problem modifying the tmp variable in the structure and adding a random element to the variables area that is not referenced anywhere ...
<cfcomponent output="false"> <cfset variables.t = {}/> <cffunction name="run" output="false" returntype="void"> <cfset var tmp = {}/> <cftry> <cfinclude template="inc2.cfm"/> <cfcatch> <cffile action="append" file="#ExpandPath("error.log")#" output="ERROR: #cfcatch.message#"/> </cfcatch> </cftry> </cffunction> </cfcomponent>
Which includes a template very similar to the first one that looks like this ...
<cfset tmp.arr = [ "one", "two", "three" ]/> <cfif ArrayLen(tmp.arr) neq 3> <cffile action="append" file="#ExpandPath("error.log")#" output="Length = #ArrayLen(tmp.arr)#"/> </cfif>
If you delete an item in the variables , it works fine. If you dump #variables# and #local# in the template, everything will be where you expect it to be.
(Update from comments)
Since then I raised this problem as an error. # 3352462