Stu*_*eld 6 coldfusion cfc coldfusion-9
我在我的应用程序范围中放置一个组件,以便在所有请求中共享它,它包含一个cfm模板:
<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>
Run Code Online (Sandbox Code Playgroud)
正在包含的模板只是创建一个数组并检查数组长度应该是什么,如果不是它写入error.log文件:
<cfset tmp = [
"one",
"two",
"three"
]/>
<cfif ArrayLen(tmp) neq 3>
<cffile action="append"
file="#ExpandPath("error.log")#"
output="Length = #ArrayLen(tmp)#"/>
</cfif>
Run Code Online (Sandbox Code Playgroud)
如果我然后在它上面运行一个加载(100个并发线程),我会在我的error.log文件中出现以下项目...
ERROR: element at position 3 of array variable "___IMPLICITARRYSTRUCTVAR0" cannot be found.
Length = 0
Length = 2
Run Code Online (Sandbox Code Playgroud)
注意我在Java 1.7.0_09上使用ColdFusion 9.0.1.274733.我在相同的JRE上测试过Railo并且工作正常.
附加以下还会导致问题,将tmp变量更改为结构并在variables范围中添加随机项,而不是在任何地方引用...
<cfcomponent output="false">
<!---
Some random variable that does nothing with the exception
of being the facilitator of my eternal pain
--->
<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>
Run Code Online (Sandbox Code Playgroud)
其中包含一个与第一个非常相似的模板,看起来像这样......
<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>
Run Code Online (Sandbox Code Playgroud)
如果您删除variables范围中的项目,它可以正常工作.如果你转储#variables#并#local#在模板中,一切都是你期望的.
(评论更新)
我已经把这个问题提到了一个bug#3352462
| 归档时间: |
|
| 查看次数: |
246 次 |
| 最近记录: |