Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Dan Switzer / Dan Switzer (Dan Switzer)
Created: 07/16/2015
Components: Language, Closures
Versions: 10.0
Failure Type: Crash
Found In Build/Fixed In Build: Final /
Priority/Frequency: Normal / Some users will encounter
Locale/System: English / Platforms All
Vote Count: 3
Problem Description:
If you have a component that declares a closure, executing the closure from a cached version of the component fails when run outside of the original request.
NOTE: The CF10 docs do indicate that a closure can't call a UDF, but Chandan Kumar (who claims to have worked on closures), says this is not accurate and that they should work. They do indeed work correct on first call:
http://stackoverflow.com/questions/10603728/a-closure-cannot-call-any-user-defined-function-in-cf-10-why
Steps to Reproduce:
Extract the attached example and run the cache-test.cfm test. The first time you run it, run it will succeed. If you run it again within 10 seconds, it will error.
The code checks if the object exists in cache and if not, creates a new component. It then does a second call, which should grab the object out of cache. On the first run, both tests succeed. On a secondary call, the closure seems to lose references to the scopes and both runs fail.
Actual Result:
java.lang.IllegalArgumentException: Response cannot be null
at coldfusion.jsp.ServletResponseWrapper.<init>(ServletResponseWrapper.java:18)
at coldfusion.jsp.HttpServletResponseWrapper.<init>(HttpServletResponseWrapper.java:13)
at coldfusion.jsp.JspWriterIncludeResponse.<init>(JspWriterIncludeResponse.java:20)
at coldfusion.runtime.NeoPageContext.pushBody(NeoPageContext.java:1935)
at coldfusion.runtime.NeoPageContext.pushBody(NeoPageContext.java:1910)
at coldfusion.filter.SilentFilter.invoke(SilentFilter.java:44)
at coldfusion.runtime.UDFMethod$ReturnTypeFilter.invoke(UDFMethod.java:405)
at coldfusion.runtime.UDFMethod$ArgumentCollectionFilter.invoke(UDFMethod.java:368)
at coldfusion.filter.FunctionAccessFilter.invoke(FunctionAccessFilter.java:55)
at coldfusion.runtime.UDFMethod.runFilterChain(UDFMethod.java:321)
at coldfusion.runtime.UDFMethod.invoke(UDFMethod.java:220)
at coldfusion.runtime.CfJspPage._invokeUDF(CfJspPage.java:2655)
at cfuser2ecfc808700091$func_CF_ANONYMOUSCLOSURE_0.runFunction....
Expected Result:
The closure should execute as expected--and the way it does on the initial request.
Any Workarounds:
The only workaround is to not use closures.
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 4021952
External Customer Info:
External Company:
External Customer Name: Dan
External Customer Email:
External Test Config: My Hardware and Environment details:
I'm currently running CF10u16 (10,0,16,293499) on CentOS. I've tested under Java 1.8.0_45, as well as the default JVM that ships with ColdFusion 10 (1.7.x). It fails under both cases.
I've also verified the bug exists in CF10 under Windows.
A co-worker is also seeing the code failing while running on Mac under both CF10 and CF11.
Attachments:
- July 16, 2015 00:00:00: 1_cf10-cfc-closure-cache-issue.zip
Comments: