Solved

CFLOOP time out

Posted on 2012-03-20
9
638 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
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 15

Expert Comment

by:Gurpreet Singh Randhawa
ID: 37748769
wrap ur cfloop inside cftimer to check and see what is the time to get
0
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now