,使其在所有請求共享,它包括AA CFM模板我設置零件在我的應用範圍內包括範圍的問題:併發當CFM從CFC
<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>
該模板被列入只需創建一個數組,並檢查數組的長度是它應該是什麼,如果不將其寫入error.log
文件:
<cfset tmp = [
"one",
"two",
"three"
]/>
<cfif ArrayLen(tmp) neq 3>
<cffile action="append"
file="#ExpandPath("error.log")#"
output="Length = #ArrayLen(tmp)#"/>
</cfif>
如果我再碰到這樣的負載(100個併發線程)我得到以下項目出現在我的error.log
文件...
ERROR: element at position 3 of array variable "___IMPLICITARRYSTRUCTVAR0" cannot be found.
Length = 0
Length = 2
注意我使用ColdFusion 9.0.1.274733 ontop的的Java 1.7.0_09的。我在同一個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>
其中包括與第一個非常相似的模板,看起來像這樣...
<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>
如果y ou刪除variables
範圍內的物品,它的工作正常。如果您在模板中轉儲#variables#
和#local#
,則所有內容都是您所期望的。
(從評論更新)
我,因爲提出這個問題作爲一個bug #3352462
這裏的任何鏈接是否有任何相關性:https://duckduckgo.com/?q="___IMPLICITARRYSTRUCTVAR0「? –
是的,看起來像它可能指向一個類似的問題,好發現 –
它也隻影響它時使用陣列的短手符號,使用'ArrayNew(1)'並單獨設置每個項目似乎按預期工作 –