• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

500 Error initializing CFC

New Here ,
Jan 17, 2022 Jan 17, 2022

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?

https://community.adobe.com/t5/coldfusion-discussions/cf2018-http-500-error-upon-startup-cache-issue...

Views

744

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2022 Jan 17, 2022

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? 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 21, 2022 Jan 21, 2022

Copy link to clipboard

Copied

Nak? 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 18, 2022 Jan 18, 2022

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:

  1.  the code of loan.cfc (Make sure you obfuscate all private or sensitive information with ***);
  2.  the code you use for initializing the CFC.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 18, 2022 Jan 18, 2022

Copy link to clipboard

Copied

What in the stacktrace suggests that there is a recusive loop or large array?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 19, 2022 Jan 19, 2022

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()

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

_factor35()?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 19, 2022 Jan 19, 2022

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:

  1.  the code of loan.cfc (Make sure you obfuscate all private or sensitive information with ***);
  2.  the code you use for initializing the CFC.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 19, 2022 Jan 19, 2022

Copy link to clipboard

Copied

Nak, please consider also what I wrote as the first reply days ago. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

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  

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

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

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022

Copy link to clipboard

Copied

Nak, I'm afraid some things are getting confused here. 

  • First, about your question regarding the logs, no. That CF admin UI for looking at the logs will NOT show you the logs for the update that I am asking about. These are in the cfusion/hf-updates folder. For more on finding and looking at them, see a post I did. It's VERY important to make sure there were 0 fatal or nonfatalerrors for the most recent update you did.
  • Next, when I asked if you'd updated the JVM, I did mean the VERSION rather than any jvm arg like that. But to be clear, I would expect that log4j JVM arg to have no impact on the issue you are raising.
  • While you say you are on 11.0.9, I'll note that the latest is 11.0.14, which came out last week. I'm not saying updating that WILL solve your problem but perhaps it could.
  • Indeed, as for why I asked if the JVM version might have changed, it's that errors like you see are SOMETIMES due to such a JVM change, if you find your CF Admin Caching page setting for "save class files" to be enabled (which Adobe recommends it should be for production). In that case, CF may have compiled your CFML requests using the OLDER JVM which (rarely) might cause problems when you change to a NEW JVM. This is far MORE often a problem only when you jump from one version (like Java 8) to another (like Java 11). 
    • Anyway, to rule this problem out, you could simply stop CF, delete the files in the cfusion/wwwroot/WEB-INF/cfclasses folder (or rename that folder), then start CF. It will then recompile your CFML pages as they are requested, which would compile them using the NEW JVM. Again, not ALWAYS needed but sometimes.

 

Let's see what you may find about the hf-updates logs, most importantly.


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

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?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2022 Jan 25, 2022

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

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2022 Jan 25, 2022

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 />

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2022 Jan 26, 2022

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.

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2022 Jan 27, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 28, 2022 Jan 28, 2022

Copy link to clipboard

Copied

Let me know what you discover.  The process has been this way for nearly a decade.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2022 Jan 30, 2022

Copy link to clipboard

Copied

LATEST

 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

BKBK_0-1643565474528.png

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. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation