|
 |
asp_web_howto thread: Catching Page Timeout
Message #1 by Darren Wogan <darrenw@s...> on Thu, 29 Mar 2001 14:57:58 +0100
|
|
I have an operation which is prone to potentially timing out. I have already
increased the page timeout for this particular page, with the following near
the top of the page:
<%
'# Allow for longer script timeout
Server.ScriptTimeout = 300
%>
so have given it up to 5 minutes (and the operation may even run for longer
than this).
I have two questions:
1) Is there anyway that I can more cleanly handle a script timeout error. I
have surrounded the relevant COM object call in this manner:
function myFunc()
{
<%
Err.clear
on error resume next
call comObj.LongRunningServiceCall (areaID, itemID, _
numbCols, numbIterations, _
resultsCollection_o)
if Err then
failed = true
errorText = Err.description & " - Error:" & Err.number & " from:
" & Err.Source
errorDesc = Err.description
response.write("alert(" & """" & errorText & """" & ", 0, " &
"""" & errorDesc & """" & ")" & vbcrlf)
end if
%>
}
However when the script times out it does not get caught by the error
handler, since the script has timed out and is abandoned. The server nicely
sends out a timeout error, however since the ASP calling the component is
within a script block, not HTML, the error message is not seen.
I believe it may be possible to set the server up in such a way as to
redirect for this error (though this may not be applicable in this
instance). However I wish to handle this more cleanly inside the page
itself.
Therefore my main question is: Is there a better way to handle a potential
script timeout?
2) The long running operation described above puts a heavy load on the
server. This affects other connected clients.
I strongly suspect the longer script timeouts also knock the server's
performance, since the calling client's details must be retained until the
COM call has finished.
Using a larger script timeout puts an additonal heavier load on the server.
I am thinking that alternatively the process could be kicked off and left
(not sure how to close the calling page though) and then I could make a
fresh ASP poll call (by using the HTML refresh page interval meta tag: e.g.
<META HTTP-EQUIV="REFRESH" CONTENT=60>
to see if the results are ready (which would have been stored in the
database temporarily).
Is this a more reasonable approach?
NB: We do not access the database directly through ASP, only through COM
components.
|
|
 |