Solved

CFLOOP time out

Posted on 2012-03-20
9
654 Views
Last Modified: 2012-04-18
I'm getting an odd timeout error when looping through the user agent to see if it's a bot.

It seems to be a simple string loop.. has anyone experience this before?   Any suggestions?
This code exists in my application.cfc file inside the onError function.

This code has been in place for over a year, every now and then this happens.  If I comment it out, everything works fine.  Later, I make it active again and it works for a while..  right now it throws the error every time I open any page.


The request has exceeded the allowable time limit Tag: CFLOOP    
The error occurred in D:\inetpub\stageRoot\PRODUCTS\ApplicationGlobal.cfc: line 76
 
75 :               <cfset isABot = true>
76 :               <cfbreak>
77 :            </cfif>
78 :         </cfloop>

 




<cfif isDefined("CGI.HTTP_USER_AGENT") and Len(CGI.HTTP_USER_AGENT)>
    <cfset theAgent = CGI.HTTP_USER_AGENT>
      <cfloop list="bot\b,crawl,\brss,feed,news,blog,reader,syndication,coldfusion,slurp,google,zyborg,emonitor,jeeves,msnbot" index="bot" delimiters=",">
            <cfif findNoCase(bot, theAgent)>
	    <cfset isABot = true>
                     <cfbreak>
            </cfif>
       </cfloop>
  </cfif>
  <cfif isABot>
       <h2>This session has been identified as a search engine spider</h2>
       <p>If you are human and not an automated BOT please contact support</p>
       <cfexit>
  </cfif>

Open in new window




Coldfusion 8
0
Comment
Question by:gdemaria
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 7

Expert Comment

by:micropc1
ID: 37744935
You can use <cfsetting requesttimeout="xx"> to increase the timeout limit of your page.

http://livedocs.adobe.com/coldfusion/8/Tags_r-s_18.html
0
 
LVL 39

Author Comment

by:gdemaria
ID: 37745337
Hey micropc1,
Thanks for the response.  I think looping a couple dozen string elements should take only a fraction of a nano second.   My timeout is already higher than the default due to some bigger equations on some pages.  Any thoughts on why the processing would hang on this simple code to cause the timeout to trigger?
0
 
LVL 16

Expert Comment

by:Gurpreet Singh Randhawa
ID: 37748769
wrap ur cfloop inside cftimer to check and see what is the time to get
0
Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

 
LVL 36

Accepted Solution

by:
SidFishes earned 500 total points
ID: 37752427
This might be cleaner

<cfif ReFindNocase(bot\b|crawl|brss|feed|news|blog|reader|syndication|coldfusion|slurp|google|zyborg|emonitor|jeeves|msnbot), CGI.HTTP_USER_AGENT>

but I'm a bit confused at this

application.cfc file inside the onError function.

How does onError gets triggered to run the bot check?

I will also note that I had nothing but problems with onError in one of my apps although I can't remember why. (may have been this http://www.raymondcamden.com/index.cfm?mode=entry&entry=ED9D4058-E661-02E9-E70A41706CD89724 but I don't remember)

 Having anything in the onError code block caused it to fail. Ended up going back to app.cfm
0
 
LVL 39

Author Comment

by:gdemaria
ID: 37758434
Hey Sid,

Thanks for the tip.  I can certainly try that.

The check is done inside the onError file because I don't mind bots spidering through the website,  I just don't like it when the create errors.   So, I don't want to email or log errors if it's just a bot going someplace that no human would go.   Therefore, I check for bots and then just ignore the error if it is one..
0
 
LVL 39

Author Comment

by:gdemaria
ID: 37758442
> wrap ur cfloop inside cftimer to check and see what is the time to get

Hey myself,

there's a catch-22 here.   When there is no time out, the cftimer shows a nice low reasonable time.  But when there is a time-out, the error is thrown and I get no info, but I assume the time is longer than the time out period..
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 37759063
so you're doing a bot check after an error occurs - could it be that the error is causing the timeout rather than the bot check and it just seems to be the loop? (as you noted there's no reason for a simple string loop to cause a time out.)
0
 
LVL 39

Author Comment

by:gdemaria
ID: 37759125
I guess that's possible and will watch for that, but there are two reasons that make me feel like this is not the case..

- I do have time outs occassionally on long running computations and they don't act this way.
- Removing this cfloop from the onError prevents the error.  That is, I don't get a time out error at all


Thanks for your insights... I will try to put in some logs/cfmail messages to narrow down the situation
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 37860687
did you ever figure out what was causing the problem?
0

Featured Post

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question