Note that there are some explanatory texts on larger screens.

plurals
  1. POCF extended components suddenly stop working
    primarykey
    data
    text
    <p>We have a set of Coldfusion applications that all extended various parts of an application base. I'll provide a bit of code and then explain the issues we are having and see if anyone can shed light on the best way to trouble shoot this:</p> <p>In our "OnRequestStart" in the app.cfc we have the following line to initiate a user:</p> <pre><code>if(!structKeyExists(SESSION, 'user')) SESSION.user = CreateObject("component","cfcs.ds_user"); </code></pre> <p>Then in the ds_user.cfc we call it like so:</p> <pre><code>component extends="cas.cas_user" displayname="basic_user"{ </code></pre> <p>The application and all its parts run just like they should. However, in a seeming random manner after a while, the application will crash and I have to restart ColdFusion Service to get it running again. The error I get is:</p> <pre><code>Could not find the ColdFusion component or interface cas.cas_user. </code></pre> <p>So, for whatever reason after a while, my application decides it cannot find the path to the parent component. The mapping for that cfc is in the application.cfc at the top as so:</p> <pre><code>THIS.mappings["/cas"] = "#ReplaceNoCase(currpath,ListToArray(THIS.name,'_')[1],'cas30')#assets\cfcs\"; </code></pre> <p>I want to be sure to say this, the application works perfectly as designed for a random amount of time and then it cannot find the parent component and will not find it again until I restart the ColdFusion Service on the server.</p> <p>I figure this is somehow a memory leak or something, but I have no idea where to start looking to troubleshoot the issue. We have 6 or so other applications that are extended in the same way and work fine and never crash, but this one does.</p> <p>EDIT: To be more clear on the mappings. Our applications are located:</p> <ul> <li>root.com/app1</li> <li>root.com/app2</li> </ul> <p>We created mappings to grab cfcs from app2 while in app1 using the method above. The method, while I believe sort of strange, does work in all of our applications.</p> <p>EDIT: The correct mappings that display for a while are:</p> <pre><code>/cfcs - D:\www\app1\assets\cfcs /templates - D:\www\app1\assets\templates /cas - D:\www\app2\assets\cfcs /common - D:\www\app3\assets\common_elements </code></pre> <p>However once the Application goes in "crashed mode", the dump reveals the mappings are as follows:</p> <pre><code>/cfcs - D:\www\app1\assets\cfcs /templates - D:\www\app1\assets\templates /cas - D:\www\app1\assets\cfcs /common - D:\www\app1\assets\common_elements </code></pre> <p>And here is how those mappings are defined at the start of the Application.cfc:</p> <pre><code>currpath = GetDirectoryFromPath(GetCurrentTemplatePath()); THIS.mappings["/templates"] = "#currpath#assets\templates"; THIS.mappings["/cfcs"] = "#currpath#assets\cfcs"; THIS.mappings["/common"] = "#ReplaceNoCase(currpath,ListToArray(THIS.name,'_')[1],'gum')#assets\common_elements\"; THIS.mappings["/cas"] = "#ReplaceNoCase(currpath,ListToArray(THIS.name,'_')[1],'cas30')#assets\cfcs\"; </code></pre> <p>THIS.name = digisign_CAAAFACBFDFFE or </p> <pre><code>name_var = (arrayLen(meta_array) &gt;= 2) ? meta_array[arrayLen(meta_array) - 1] &amp; '_' : 'root_'; THIS.name = name_var &amp; right(reReplace(hash(getCurrentTemplatePath()), "[^a-zA-Z]","","all"), 64 - len(name_var)); </code></pre> <p>Where could it be failing. It seems the replace statement isn't working and therefore the appname in the path is not being changed from app1 to app2 when setting the mappings. is it possible this is related to this error we are currently working through: <a href="http://forums.adobe.com/message/4657868#4657868" rel="nofollow noreferrer">http://forums.adobe.com/message/4657868#4657868</a> We have yet to apply the Update 4 patch on production. However this problem we believe was happening before CF10. And while we have this issue, it only cropped up recently. This application in question has been crashing like this for a long time.</p> <p><strong>EDIT:</strong> 1. I guess when I say "crash" I mean the application gets into a state, where it will not declare the mappings correctly until I restart Coldfusion. I assume the error in our code causes the crash. 2.This is usually where the issue occurs, when doing this check of the SESSION.user var. I believe it has happened as well, it decides it cannot find our datasource. This is rare. 3. At first I thought yes, but actually no, not that many. Throughout our apps we have several names for common mappings. <code>cas</code> <code>common</code> <code>cfcs</code> <code>templates</code> etc. However <code>D:\www\cas</code> is where the application <code>domain.com/cas30</code> is located. However a legacy version of that app is located at <code>domain.com/cas</code>. The mapping <code>/cas</code> should go to <code>D:\www\cas30\assets\cfcs</code> and works. 4.We have a dev setup and this never happens. (I assumed it was a load issue which is why it doesn't happen on dev). However, our dev environment is structred as so:</p> <pre><code>D:\www\deva\app1 D:\www\deva\app2 D:\www\devb\app1 D:\www\devb\app2 </code></pre> <ol start="5"> <li>What we do (which I think is stupid) is we have a file located not in the same dir as the current app. This file is called application_base.cfc. All of the application.cfcs in the other applications extend from this application_base.cfc. They are not extended from other Application.cfc files. (hope that makes sense) In application_base is a init, onrequeststart, and an onerror. I'll post the App.cfc below. Also some setting are read from XML files both in the application base (to determine environment stuff) and at the application level. However we thought that might be causing the issue so the previous developer removed the xml file at the application level. 6.Yes. I'll post the app.cfc and the appbase.cfc so you can view both.</li> <li>By reinitialize you mean call onapplicationstart or something. Not that I know of.</li> <li><p>A few applications we have do:</p> <p>currpath = GetDirectoryFromPath(GetCurrentTemplatePath()); app_path = ListToArray(currpath,'\'); THIS.name = app_path[ArrayLen(app_path)];</p></li> </ol> <p>This one does:</p> <pre><code>meta_array = ListToArray(GetMetaData(this).name,'.'); name_var = (arrayLen(meta_array) &gt;= 2) ? meta_array[arrayLen(meta_array) - 1] &amp; '_' : 'root_'; THIS.name = name_var &amp; right(reReplace(hash(getCurrentTemplatePath()), "[^a-zA-Z]","","all"), 64 - len(name_var)); </code></pre> <p>A few others do this as well. Not sure if it was two different developers or something, but that is the way it is.</p> <p>Once the app fails, it fails until I restart coldfusion. The app requires login from the <code>domain.com/app</code> page, so (not saying it cant change from request to request) but the request location is always the same where it's failing.</p> <p>God I wish it wasn't this complex. I recently pulled our current CMS off of alot of this crazy stuff, but we have 7 or 8 applications that are so intertwined with each other and designed to work in dev/prod environments with different paths, its sometimes hard to tell what I can remove and what I can't.</p> <p>I thought I tried dumping the applicationname from our error handler, but I thought it didn't work unless passed in. I passed through the mappings so I could see them which is how I know <code>digisign</code> is not changing to <code>cas30</code> like it should in "crash" mode.</p> <p>I think all the dynamic mappings were so the original developer could just use the same app.cfc template without changing anything. He liked to do stuff like <code>var a = (b) ? (a-c) ? a-f+b : (a+b) ? d : d; : a; h;</code> crap with no comments so it sometimes hard to just read the damn code let alone debug it.</p> <p><strong>EDIT</strong></p> <p>I feel like this issue and <a href="https://stackoverflow.com/q/14300915/1229594">stackoverflow.com/q/14300915/1229594</a> issue may be related. I've posted some more details here as well: <a href="http://forums.adobe.com/message/5022377#5022377" rel="nofollow noreferrer">forums.adobe.com/message/5022377#5022377</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload