Copy link to clipboard
Copied
Over the weekend I ran into an issue with initializing a CFC; when cfcomponent is called a 500 error is thrown. When reveiwing the exception.log file I see the following:
java.lang.StackOverflowError
at java.base/java.util.HashMap.putVal(HashMap.java:624)
at java.base/java.util.HashMap.put(HashMap.java:607)
at coldfusion.runtime.LocalScope._bindInternal(LocalScope.java:538)
at coldfusion.runtime.NeoPageContext.setVariableScope(NeoPageContext.java:2047)
at coldfusion.runtime.NeoPageContext.SymTab_initializeForPage(NeoPageContext.java:1254)
at coldfusion.runtime.NeoPageContext.<init>(NeoPageContext.java:256)
at coldfusion.runtime.CfJspPage.initialize(CfJspPage.java:163)
at coldfusion.runtime.TemplateProxyFactory.resolveComponentHelper(TemplateProxyFactory.java:555)
at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:286)
at coldfusion.runtime.TemplateProxyFactory.resolveComponentHelper(TemplateProxyFactory.java:412)
at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:286)
at coldfusion.runtime.TemplateProxyFactory.resolveComponentHelper(TemplateProxyFactory.java:412)
at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:272)
at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:164)
at coldfusion.runtime.TemplateProxyFactory.resolveName(TemplateProxyFactory.java:154)
at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:81)
at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:56)
at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:101)
at coldfusion.runtime.ProxyFactory.getProxy(ProxyFactory.java:91)
at coldfusion.runtime.CFPage._createObjectProxy(CFPage.java:10714)
at coldfusion.runtime.CFPage.createObjectProxy(CFPage.java:10670)
at coldfusion.tagext.lang.ObjectTag.doStartTag(ObjectTag.java:535)
at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:5201)
at cfloan2ecfc904776707._factor35(D:\Websites\ycWeb\trunk\yc\cfc_files\system\builder\loan.cfc:3)
at cfloan2ecfc904776707.runPage(D:\Websites\ycWeb\trunk\yc\cfc_files\system\builder\loan.cfc:1)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:257)
This began after updating our CF2021 server to Updater 3.
I've reviewed this post and I've seen Charlies fix, but why would this be occurring to begin with?
Copy link to clipboard
Copied
Well, I'd say first that it's not clear that the issue in that other thread is the same as what you see here. 🙂 There's no indication of a stackoverflow error there, like you show here. Also, in that thread they say the problem happens only at startup. Are you saying that's the case here?
Also, you refer to my "fix" but I discussed several over the entire thread. Which did you do?
Finally, you mention having done update 3. First, what update were you on before? Second, did you check the install log in the update folder, to confim all "successes" and 0 fatalerrors. Last, are you confirming you really did NOTHING else? No change of the jvm also, perhaps? What jvm and update are you on, per the cf admin settings summary page?
Copy link to clipboard
Copied
Nak?
Copy link to clipboard
Copied
java.lang.StackOverflowError at java.base/java.util.HashMap.putVal(HashMap.java:624) at java.base/java.util.HashMap.put(HashMap.java:607) at coldfusion.runtime.LocalScope._bindInternal(LocalScope.java:538) at coldfusion.runtime.NeoPageContext.setVariableScope(NeoPageContext.java:2047) ... at cfloan2ecfc904776707._factor35(D:\Websites\ycWeb\trunk\yc\cfc_files\system\builder\loan.cfc:3) at cfloan2ecfc904776707.runPage(D:\Websites\ycWeb\trunk\yc\cfc_files\system\builder\loan.cfc:1) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:257)
By @nak33
Those lines of stacktrace suggest your code might have generated a recursive loop or an excessively large array. Could you please share the following:
Copy link to clipboard
Copied
What in the stacktrace suggests that there is a recusive loop or large array?
Copy link to clipboard
Copied
What in the stacktrace suggests that there is a recusive loop or large array?
By @nak33
StackOverflowError
at java.base/java.util.HashMap.putVal()
at cfloan2ecfc904776707._factor35()
Copy link to clipboard
Copied
_factor35()?
Copy link to clipboard
Copied
_factor35()?
By @nak33
Yes, a function call (or possibly an anonymous function or closure) made by an instance of loan.cfc. The instance is the object called cfloan2ecfc904776707.
Could you please share the following:
Copy link to clipboard
Copied
Nak, please consider also what I wrote as the first reply days ago.
Copy link to clipboard
Copied
Charlie,
Thanks for the response. I apologize for not getting back earlier. Here are the answers to your question:
Well, I'd say first that it's not clear that the issue in that other thread is the same as what you see here.
-There's no indication of a stackoverflow error there, like you show here. Also, in that thread they say the problem happens only at startup. Are you saying that's the case here? NO - It occurred and to resolve the issue the Coldfusion server needed to be restarted.
Also, you refer to my "fix" but I discussed several over the entire thread. Which did you do? I have not done anything yet to resolve the issue as it hasn't occurred again.
Finally, you mention having done update 3. First, what update were you on before? Updater 1. Second, did you check the install log in the update folder, to confim all "successes" and 0 fatalerrors. I'm not seeing the updater logs in the log directory: https://www.asanet.org/sites/default/files/savvy/CFIDE/administrator/help/logtypes.htm is there somewhere else these logs would be stored. Last, are you confirming you really did NOTHING else? change of the jvm also, perhaps? No What jvm and update are you on, per the cf admin settings summary page? 11.0.9+7-LTS
Copy link to clipboard
Copied
Charlie,
I was incorrect. There was one JVM update made. Adobe posted an update to the JVM when the log4j vunerability first appeared (prior to the Updater). https://helpx.adobe.com/coldfusion/kb/log4j-vulnerability-coldfusion.html
This was added to the jvm.config:
-Dlog4j2.formatMsgNoLookups=true
Copy link to clipboard
Copied
Nak, I'm afraid some things are getting confused here.
Let's see what you may find about the hf-updates logs, most importantly.
Copy link to clipboard
Copied
Charlie,
In regards to the logs, here's what I'm seeing.
355 Successes
1 Warnings
0 NonFatalErrors
0 FatalErrors
There were no updates to the version of JVM.
I'd like to avoid updating the JVM if possible, as this just started occurring recently, which is what lead me to believe it was due to the Updater.
Any other possible culprits?
Copy link to clipboard
Copied
@nak33 , thanks for updating us.
In regards to the logs, here's what I'm seeing.
355 Successes
1 Warnings
0 NonFatalErrors
0 FatalErrors
By @nak33
What is the warning?
Also, going back to the very beginning, could you please share the following lines of code:
D:\Websites\ycWeb\trunk\yc\cfc_files\system\builder\loan.cfc:1
D:\Websites\ycWeb\trunk\yc\cfc_files\system\builder\loan.cfc:3
Copy link to clipboard
Copied
The warning is:
Move Folder: Destination: C:\Users\yccfuser\534597.tmp\dist\cfusion
Status: WARNING
Additional Notes: WARNING - Source C:\Users\yccfuser\534597.tmp\dist\cfusion\_win64 does not exist.
The lines of code are for a databased handler initialization method, called literally 1000s of times before without issue.
<cfobject component="cfc_files.database_handler.loan" name="objloan_db_handler" />
<cfset this.objloan_db_handler = objloan_db_handler />
Copy link to clipboard
Copied
Thanks for sharing that.
The warning:
I think we may indeed ignore the warning.
The two lines of code:
The error message suggests that the code appears as follows within the component D:\Websites\ycWeb\trunk\yc\cfc_files\system\builder\loan.cfc
<cfcomponent>
<cfobject component="cfc_files.database_handler.loan" name="objloan_db_handler" />
<cfset this.objloan_db_handler = objloan_db_handler />
....
</cfcomponent>
If that is indeed so, then the code is part of the so-called "constructor" code. It means that whenever \system\builder\loan.cfc is instantiated, the following cascade of events happens:
- cfc_files.database_handler.loan.cfc is instantiated;
- the constructor code within cfc_files.database_handler.loan.cfc is executed during the instantiation.
Apparently, ColdFusion ran into problems during that process.
Copy link to clipboard
Copied
About code of the form:
<!--- Object instantiation code located in the component's constructor area --->
<cfcomponent>
<cfobject />
</cfcomponent>
I instinctively feel that this is not quite right. I suspect ColdFusion would have a problem with it, sooner or later.
I am looking into it and doing some tests.
Copy link to clipboard
Copied
Let me know what you discover. The process has been this way for nearly a decade.
Copy link to clipboard
Copied
The process has been this way for nearly a decade.
By @nak33
I understand.
However, it is worth pointing out that the ColdFusion application server has changed a lot in recent years. Generally for the better.
Though ColdFusion promises backward-compatibility, it cannot always fulfill that promise.
Let me know what you discover.
By @nak33
I have been able to show that, if you use code of the form
<cfcomponent>
<cfobject />
</cfcomponent>
it can lead to problems.
The demo consists of 5 files. Create a test directory under the web root and place the 5 files in it.
<!--- Application.cfc --->
component {
this.name = "cf_forum_Nak33Test";
this.sessionManagement = true;
boolean function onApplicationStart() {
return true;
}
}
<!--- Test1.cfc --->
<cfcomponent>
<cfobject component="test2" name="t2" />
<cfset this.t2 = t2>
</cfcomponent>
<!--- Test2.cfc --->
<cfcomponent accessors="true">
<cfproperty name="p1">
<cfproperty name="p2">
<cffunction name="init" returntype="any">
<cfset variables.p1="I am property p1 of Test2 CFC">
<cfset variables.p2="I am property p2 of Test2 CFC">
<cfset variables.properties = {property1="#p1#",property2="#p2#"}>
<cfreturn this>
</cffunction>
</cfcomponent>
<!--- testPage1.cfm --->
<cfset test1Obj = new Test1()>
<cfdump var="#test1Obj#" >
<!--- testPage2.cfm --->
<cfset test2Obj = new Test2()>
<cfdump var="#test2Obj#" >
Now, on to the test.
Launch the page testPage2.cfm, followed by the page testPage1.cfm. You should get something like
Result of the test: using <cfobject> in the constructor code of Test1 creates an instance of Test2 in which the value of the instance properties p1 and p2 is null. That is incorrect. Test2.cfc is defined such that every instance of it will contain a value for the properties p1 and p2.