Title:
Implicit Setters on Entities are sometimes unresolved and CF searches CGI scope causing Error while reading header
| View in TrackerStatus/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): Steven Erat / Steven Erat (StevenErat)
Created: 03/07/2012
Components: Language, CF Component
Versions: 9.0.1
Failure Type: Non Functioning
Found In Build/Fixed In Build: 9.0.1 / CF10_Update14
Priority/Frequency: Major / Some users will encounter
Locale/System: English / Windows 7
Vote Count: 7
Problem Description:
Discussed at length here:
http://stackoverflow.com/questions/9473252/why-does-a-coldfusion-implicit-setter-end-up-making-networking-calls/9607378#9607378
I have found that in ColdFusion 9.01, sometimes calls to implicit setters causes ColdFusion to try to resolve the setter method as though it were a property, and it will look into the CGI scope to try to find it. If the user browser has disconnected, closed, clicked-away, etc, then the CGI lookup may produce "error Error while reading header <property>", as described in issue 3132879.
EXAMPLE (Mock Code):
I have the following entity shown here (partly):
component persistent="true" table="myTable" output="false" extends="myBaseClass" {
property name="myProperty" column="myProperty" type="date" ormtype="timestamp";
Notice that it extends myBaseClass, which is shown (partly) here:
component {
public void function doSomething(){
if (hasProperty('myProperty'))
setMyProperty(now());
}
On some occasions when a template is requested which uses the entity, the template request appears to hang in the browser indefinitely with address bar spinning. Later when viewing the logs, I would find a related entry for the request showing the "error while reading header".
03/06 13:45:52 error Error while reading header SETMYPROPERTY
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
...
at coldfusion.runtime.CgiScope.resolve(CgiScope.java:221)
at coldfusion.runtime.CgiScope.containsName(CgiScope.java:301)
at coldfusion.runtime.CgiScope.search(CgiScope.java:334)
...
at cfmybaseclass2ecfc1915167844$funcDOSOMETHING.runFunction(X:\MyApp\myBaseClass.cfc:8)
...
at coldfusion.orm.hibernate.HibernateEventHandler.onFlushDirty(HibernateEventHandler.java:130)
...
at coldfusion.orm.hibernate.HibernatePersistenceManager.onCommit(HibernatePersistenceManager.java:950)
...
at cfsomecomp2ecfc1707726523$funcRUN.runFunction(X:\MyApp\SomeComp.cfc:131)
This stack trace tells me that ColdFusion was trying to resolve an implicit setter and tried to find it in the CGI scope by asking the connector for an HTTP request header of the same name.
To me, trying to resolve an implicit getter by searching the CGI scope for the Request Header seems like a ColdFusion defect.
Any Workarounds:
Set the entity property directly, don't use the implicit setter. In the above example code replace setMyProperty(now()); with myProperty = now();
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3132889
Deployment Phase: Release Candidate
External Customer Info:
External Company:
External Customer Name: StevenErat
External Customer Email:
External Test Config: Here is a truncated stack trace. The entity has a property modifiedOn, and the implicit setter is called in the base class in an implicit setter SetModifiedOn, and the setter is shown in the error
regarding header after a CGI lookup after ORM.
03/06 13:45:52 error Error while reading header SETMODIFIEDON
java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
...
at coldfusion.runtime.CgiScope.resolve(CgiScope.java:221)
at coldfusion.runtime.CgiScope.containsName(CgiScope.java:301)
at coldfusion.runtime.CgiScope.search(CgiScope.java:334)
at coldfusion.runtime.NeoPageContext.searchScopes(NeoPageContext.java:766)
...
at cfbase2ecfc1915167844$funcPREUPDATE.runFunction(D:\PRIVATE\base.cfc:8)
...
at coldfusion.orm.hibernate.HibernateEventHandler.invokeMethod(HibernateEventHandler.java:245)
at coldfusion.orm.hibernate.HibernateEventHandler.invokeInterceptorMethod(HibernateEventHandler.java:190)
at coldfusion.orm.hibernate.HibernateEventHandler.onFlushDirty(HibernateEventHandler.java:130)
at org.hibernate.event.def.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:372)
...
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
...
at coldfusion.tagext.sql.TransactionTag.doEndTag(TransactionTag.java:300)
at cfivansProcessor2ecfc1707726523$funcPROCESSPOLICYREQUESTS.runFunction(D:\PRIVATE\myProcessor.cfc:131)
...
at cfmyProcessor2ecfc1707726523$funcPROCESSBATCH.runFunction(D:\PRIVATE\myProcessor.cfc:44)
...
at cfmyThreadManager2ecfc1645989653$func_CFFUNCCFTHREAD_CFMYTHREADMANAGER2ECFC16459896531.runFunction(D:\PRIVATE\myThreadManager.cfc:57)
Attachments:
Comments: