Solved

CFLOOP time out

Posted on 2012-03-20
9
634 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:myselfrandhawa
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

23 Experts available now in Live!

Get 1:1 Help Now