Answered
CF Pages SLOOOOOW (basically never run)
Returning to CF programming after 5 years away from
programming entirely, I was able to write four pages (displaying
and updating records in SQL Server) which were working great until
I set up an Application.cfm page to allow for a login screen. Then
they all ground to a halt (e.g. 15 minutes, after which I gave up
and cancelled them). This happened with CF 5, so I just installed
CF8 (developer version) in hopes of fixing it, but that doesn't run
at all yet, as described in another posting I just did (JNDI port
2930 for server Coldfusion not active). This is probably not a
conflict with CF5, since I uninstalled that before attempting to
install CF8.
Yesterday and this morning, when CF5 was still installed, whenever the pages hung and I checked Performance in Task Manger, it was always at 100%. The problem must be something in Application.cfm since all I had to do is rename it to xApplication.cfm, and the pages worked fine just as they had before. I did this on two different computers with the same results - both the problem and the 'fix' to it be renaming Application.cfm (If it matters, one of the computer has 500MB of RAM; the other had 1GB; both are running Windows XP Professional).
A very interesting result occurred if I entered a page other than the login page into the brower's address bar, then renamed Application.cfm WHILE THE PAGE WAS STILL TRYING TO LOAD (which it should not allow me to do, right, if Application.cfm was in use?). What happened was that the browser was suddenly redirected to the login page, just as Application.cfm instructed it to do if Session.LoggedIn was false. So it must have been running Application.cfm, or how would it have known to do that?
Your help with this problem (which would probably happen with CF8, too, is my guess) would be greatly appreciated!
My Application.cfm page (which I mostly copied from Programming ColdFusion by O'Reilly, p. 204), is shown after the double dashed line below. The 'cfoutput' tags were intended to show me how far it got, and strangely, numbers '1' and '2' were working at one point yesterday, then stopped working for some reason; the 'cfouput' of cgi.script_name and Session.LoggedIn were added later, and never have worked. As you can see, some sections of code, including 'cflock' tags, are currently commented out, but that didn't help.
=================================================================================
<cfapplication name="Reporters" sessionmanagement="Yes" setclientcookies="Yes" sessiontimeout="#CreateTimeSpan(0,0,30,0)#" applicationtimeout="#CreateTimeSpan(0,0,30,0)#">
<cfoutput>'1'</cfoutput>
<cflock scope='Session' type='Exclusive' timeout='10'>
<cfparam name='Session.LoggedIn' Default='False'>
</cflock>
<cfoutput>#Session.LoggedIn#</cfoutput>
<cfoutput>#cgi.script_name#</cfoutput>
<cfoutput>'2'</cfoutput>
<!-- If the user isn't logged in or they aren't currently on the login page, send them to the login page -->
<!--<cflock scope='Session' type='Readonly' timeout="10"> -->
<cfif not Session.LoggedIn>
<cfoutput>'3'</cfoutput>
<cfif cgi.script_name is not 'Reporters/ReporterLogin.cfm'>
<cflocation url='/Reporters/ReporterLogin.cfm'>
</cfif>
</cfif>
<!-- </cflock> -->
<cfoutput>'4'</cfoutput>
<!-- Reset the CFID and CFToken cookies to expire session and client variables after the user's browser closes
<cfif IsDefined('Cookie.CFID') and IsDefined('Cookie.CFToken')>
<cfcookie name='CFID' value='#Cookie.CFID#'>
<cfcookie name='CFToken' value='#Cookie.CFToken#'>
</cfif>
-->
<!-- If Application variables other than the name of the app are used, set them here (with CFLOCK) -->
Yesterday and this morning, when CF5 was still installed, whenever the pages hung and I checked Performance in Task Manger, it was always at 100%. The problem must be something in Application.cfm since all I had to do is rename it to xApplication.cfm, and the pages worked fine just as they had before. I did this on two different computers with the same results - both the problem and the 'fix' to it be renaming Application.cfm (If it matters, one of the computer has 500MB of RAM; the other had 1GB; both are running Windows XP Professional).
A very interesting result occurred if I entered a page other than the login page into the brower's address bar, then renamed Application.cfm WHILE THE PAGE WAS STILL TRYING TO LOAD (which it should not allow me to do, right, if Application.cfm was in use?). What happened was that the browser was suddenly redirected to the login page, just as Application.cfm instructed it to do if Session.LoggedIn was false. So it must have been running Application.cfm, or how would it have known to do that?
Your help with this problem (which would probably happen with CF8, too, is my guess) would be greatly appreciated!
My Application.cfm page (which I mostly copied from Programming ColdFusion by O'Reilly, p. 204), is shown after the double dashed line below. The 'cfoutput' tags were intended to show me how far it got, and strangely, numbers '1' and '2' were working at one point yesterday, then stopped working for some reason; the 'cfouput' of cgi.script_name and Session.LoggedIn were added later, and never have worked. As you can see, some sections of code, including 'cflock' tags, are currently commented out, but that didn't help.
=================================================================================
<cfapplication name="Reporters" sessionmanagement="Yes" setclientcookies="Yes" sessiontimeout="#CreateTimeSpan(0,0,30,0)#" applicationtimeout="#CreateTimeSpan(0,0,30,0)#">
<cfoutput>'1'</cfoutput>
<cflock scope='Session' type='Exclusive' timeout='10'>
<cfparam name='Session.LoggedIn' Default='False'>
</cflock>
<cfoutput>#Session.LoggedIn#</cfoutput>
<cfoutput>#cgi.script_name#</cfoutput>
<cfoutput>'2'</cfoutput>
<!-- If the user isn't logged in or they aren't currently on the login page, send them to the login page -->
<!--<cflock scope='Session' type='Readonly' timeout="10"> -->
<cfif not Session.LoggedIn>
<cfoutput>'3'</cfoutput>
<cfif cgi.script_name is not 'Reporters/ReporterLogin.cfm'>
<cflocation url='/Reporters/ReporterLogin.cfm'>
</cfif>
</cfif>
<!-- </cflock> -->
<cfoutput>'4'</cfoutput>
<!-- Reset the CFID and CFToken cookies to expire session and client variables after the user's browser closes
<cfif IsDefined('Cookie.CFID') and IsDefined('Cookie.CFToken')>
<cfcookie name='CFID' value='#Cookie.CFID#'>
<cfcookie name='CFToken' value='#Cookie.CFToken#'>
</cfif>
-->
<!-- If Application variables other than the name of the app are used, set them here (with CFLOCK) -->