Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allowing longer processing time on a particular form

Status
Not open for further replies.

dakota81

Technical User
May 15, 2001
1,691
US
The Coldfusion server is set up to timeout processing after a certain length of time, to protect against say, an infinate loop.

Is there something I can write into one of my pages to extend that time-length? I've got a form that gathers data and uploads them to our server, and I send the data in as two long strings (comma delimited) which is the data that gets inserted into the tables. This list might grow to a couple hundred entries at a time, and sometimes times out the server and cannot complete.

Or maybe is there a fast way to take a list and pull out the items one by one? This is the loop that is processed:
Code:
<cfloop from=&quot;1&quot; to=&quot;#listlen(FORM.tracking)#&quot; index=&quot;i&quot;>
 <cfquery datasource=&quot;zeronine&quot; name=&quot;addtracks&quot;>
  INSERT INTO ups (tracking, reference)
  VALUES ('#trim(ListGetAt(FORM.tracking,i))#', '#trim(ListGetAt(FORM.reference,i))#')
 </cfquery>
</cfloop>
 
Well... not technically, no.
The setting you enter into CF Administrator for your timeouts will trump anything else you try. And no matter what, your timeouts will never be able to be any longer than that setting.

However... you can set a timeout in your CFAPPLICATION tag (for both the session and the application) and several other tags (like CFHTTP, etc).

So... while it's an undertaking to update all the pages that use these tags, you can certainly set the settings in CF Administrator to something on the high end, then use the local settings to pare that down to shorter timeouts as appropriate.

I would have to say, however, that using timeouts to protect against infinite loops is not a great programming style. I know that you just picked on that as an example, but you should trap potential run-away loops in other ways. Timeouts are really there just to help deal with network issues and things you have no control of any other way.


-Carl
 
Not True
You could put a requestTimeOut in your url...

requestTimeOut=120
would set your timeout to 120 seconds......




------------------------------------------------------------------------------
brannonH
if( !succeed ) try( );
 
ps you would need to either uncheck the Timeout requests in your Admin or set it to a higher number then use the requestTimeOut to minimize on specific pages....

------------------------------------------------------------------------------
brannonH
if( !succeed ) try( );
 
But even if you pass requesttimeout=120 on the URL, if your request time out setting in CF Administrator is 60 it will trump all other settings... so the longest it'll wait is 60 seconds.

You'd need to set the Administrator setting to the highest time out you'd want anywhere on your site, and then use requesttimeout= or the other timeout attributes of various tags to set it to shorter durations on a level local to the specific request.


-Carl
 
I believe that is what my second post says…

------------------------------------------------------------------------------
brannonH
if( !succeed ) try( );
 
thanks for the info, and trying not to request changes to the coldfusion server then is there maybe a different way I could rewrite the loop I'm trying to process to make it faster? Are there any shortcuts to parsing through a list?

And I used the inifinate loop example because that's an example used in Macromedia's own development book of why you need a timeout.
 
Any shortcuts parsing through a list?
Depends greatly on the list, it's source, and what exactly you're trying to parse out of it.

But regarding when to use timeouts to solve issues and when not to; I'm not sure what Macromedia &quot;development book&quot; you're referring to (there are several), but in general, timeouts should be used to protect your pages against things that you do not have control over that cause serious ColdFusion issues. An unresponsive database. A hard drive that's unexpectedly gone down or won't wake up. A network cable that inadvertantly gets unplugged from the wall.

An infinite loop is not a serious ColdFusion issue. A serious coding issue, sure... but not a ColdFusion issue. You should plan against, and trap, possible infinite loops by using good programming practices rather than using ColdFusion's timeouts as a crutch.


That being said, the CF MX Web Application Construction Kit, 5th ed., by Ben Forta and Nate Weiss, states that the timeout attribute of the
Code:
<CFSETTING>
tag will actually override the CF Administrator setting for the page on which it's used. Everything else I've read has stated the exact opposite (Administrator trumps everything, including CFSETTING)... but perhaps this is something new/changed in MX. So, according to this book, you can have the CF Administrator &quot;Timeout Requests after&quot; setting enabled and set to, say, 30 seconds... and then you can use the
Code:
<CFSETTING requesttimeout=&quot;300&quot;>
at the top of some page like alongrunningpage.cfm, and alongrunningpage.cfm will not time out until 5 minutes.

I don't know if the same hold true if you include &quot;requesttimeout=&quot; on the URL.


-Carl
 
I put out the infinate loop example just because I did read it in a coldfusion book and it does easily show one example of why timeouts are needed (and I wasn't sure if I was explaining the situation clearly enough in my original post, but everyone caught on to what I was saying, so the example served it's purpose). That's all, I know I'm never going to intentially put one it. My problem is I may need to insert many records into a table at once (say 500+) and the processing time can exceed the timeout before completing.

I will test the request timeout tag and see if it will override the administrator settings. We've currently got ColdFusion 5 if that makes a difference.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top