Highlighted

CF 2018 - Random Crash When Initializing ORM Entities

New Here ,
Jan 29, 2019

Copy link to clipboard

Copied

Hi all,

We are seeing a really weird, totally random crash on 2018. This is with code that is currently running fine in production on 2016, and ran fine on 11. Here are definitions for three simple objects that produce the crash:

BaseEntity.cfc

component mappedSuperClass="true" accessors="true" {
    property name="id" fieldtype="id" generator="identity";
}

BaseType.cfc

component mappedSuperClass="true" accessors="true" extends="BaseEntity" {
    property name="title" fieldtype="column" ormtype="string";
}

PersonType.cfc

component accessors="true" extends="BaseType" persistent="true" {
    property name="People" fieldtype="one-to-many" cfc="Person" inverse="true" inverseJoinColumn="PersonTypeID" singularname="Person";
}

PersonType.cfc here is just an example. The third component in the chain could be totally empty (so only containing the inherited ID and Title).

What we are seeing is that Coldfusion 2018 will crash at a random time, with an exception trying to initialize a component that extends BaseType. If the page I am loading doesn't load a PersonType, but maybe loads an object of AnimalType that also extends BaseType, it could crash on that component instead. Once the crash has occurred, any code that tries to load any object that extends BaseType will crash. The only remedy is to shut down the Coldfusion service, clear the files cached in cfusion/wwwroot/WEB-INF/cfclasses, and restart the service.

When I say random, I mean that you could refresh the same page numerous times loading the same component, but at some indeterminate point it will crash with the exception.

When you drill down the exception dump to find the root cause, it always comes back to something in Coldfusion's internals:

Caused by: java.lang.ClassCastException: coldfusion.runtime.AttributeCollection cannot be cast to java.base/java.lang.String at coldfusion.runtime.TemplateProxy.findAbstractMethodsRecursively(TemplateProxy.java:1590) at coldfusion.runtime.TemplateProxy.validateAbstractContract(TemplateProxy.java:1903) at coldfusion.runtime.TemplateProxy.validateComponent(TemplateProxy.java:1541) at coldfusion.runtime.TemplateProxy.verifyInterfacesImpl(TemplateProxy.java:1952) at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:82) at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:56) at coldfusion.orm.hibernate.CFCTuplizer$CFCinstantiator.instantiate(CFCTuplizer.java:198) ... 125 more

It seems like this is happening when Coldfusion decides it needs to recompile/recache the component. Turning on Trusted Cache drastically reduces the chances of it happening.

Has anyone else run into this? This is a showstopper for us migrating from 2016 to 2018.

Views

247

Likes

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

CF 2018 - Random Crash When Initializing ORM Entities

New Here ,
Jan 29, 2019

Copy link to clipboard

Copied

Hi all,

We are seeing a really weird, totally random crash on 2018. This is with code that is currently running fine in production on 2016, and ran fine on 11. Here are definitions for three simple objects that produce the crash:

BaseEntity.cfc

component mappedSuperClass="true" accessors="true" {
    property name="id" fieldtype="id" generator="identity";
}

BaseType.cfc

component mappedSuperClass="true" accessors="true" extends="BaseEntity" {
    property name="title" fieldtype="column" ormtype="string";
}

PersonType.cfc

component accessors="true" extends="BaseType" persistent="true" {
    property name="People" fieldtype="one-to-many" cfc="Person" inverse="true" inverseJoinColumn="PersonTypeID" singularname="Person";
}

PersonType.cfc here is just an example. The third component in the chain could be totally empty (so only containing the inherited ID and Title).

What we are seeing is that Coldfusion 2018 will crash at a random time, with an exception trying to initialize a component that extends BaseType. If the page I am loading doesn't load a PersonType, but maybe loads an object of AnimalType that also extends BaseType, it could crash on that component instead. Once the crash has occurred, any code that tries to load any object that extends BaseType will crash. The only remedy is to shut down the Coldfusion service, clear the files cached in cfusion/wwwroot/WEB-INF/cfclasses, and restart the service.

When I say random, I mean that you could refresh the same page numerous times loading the same component, but at some indeterminate point it will crash with the exception.

When you drill down the exception dump to find the root cause, it always comes back to something in Coldfusion's internals:

Caused by: java.lang.ClassCastException: coldfusion.runtime.AttributeCollection cannot be cast to java.base/java.lang.String at coldfusion.runtime.TemplateProxy.findAbstractMethodsRecursively(TemplateProxy.java:1590) at coldfusion.runtime.TemplateProxy.validateAbstractContract(TemplateProxy.java:1903) at coldfusion.runtime.TemplateProxy.validateComponent(TemplateProxy.java:1541) at coldfusion.runtime.TemplateProxy.verifyInterfacesImpl(TemplateProxy.java:1952) at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:82) at coldfusion.cfc.ComponentProxyFactory.getProxy(ComponentProxyFactory.java:56) at coldfusion.orm.hibernate.CFCTuplizer$CFCinstantiator.instantiate(CFCTuplizer.java:198) ... 125 more

It seems like this is happening when Coldfusion decides it needs to recompile/recache the component. Turning on Trusted Cache drastically reduces the chances of it happening.

Has anyone else run into this? This is a showstopper for us migrating from 2016 to 2018.

Views

248

Likes

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
Jan 29, 2019 2
New Here ,
Mar 02, 2020

Copy link to clipboard

Copied

We are seeing this issue migrating from CF11 to CF2018.  This question is over a year old, is there a solution to this issue?

In our case the recursive calls to findAbstractMethodsRecursively ultimately cause a java stack overflow.

 

Likes

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
Reply
Loading...
Mar 02, 2020 0
Adobe Community Professional ,
Mar 02, 2020

Copy link to clipboard

Copied

FWIW, I have not heard of this error other than from this thread. To you both, I would ask if you could each confirm and report:

  • what update, if any, have you applied to your CF2018? You can see that on the updates page or on the "system information" page (using the "i" in the top right corner of the CF Admin), among other places
  • and can you please check to make sure that there are zero errors in the update log for whatever last CF2018 update you did apply? For more on that, see my post here. It's possible that an error in the update may be the cause, even if no other issues happen
  • can you both indicate if you had done any importing of settings from another CF version, whether using the CF "archive" or CAR feature of the Admin, or by performing an import of settings on the first launch of the admin, after installation? It's possible that some unexpected setting change was brought in and is causing trouble (which would explain why the problem is seemingly rare). Here's good news: I realize you may each say you can't recall or don't know if such migration or car import was done. But fortunately there is a log that CF keeps, if either is ever done. See the CF logs folder, and is there a log whose name starts with migration or car? If so, read the log to see what sort of things happened, and if any error happened.

 

Hope that may help. If not, perhaps others will chime in.

/Charlie (server troubleshooter, carehart.org)

Likes

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
Reply
Loading...
Mar 02, 2020 0