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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error 'ASP 0115', Trappable error (C0000005) occurred in an external object

Status
Not open for further replies.

sugarflux

Technical User
Aug 14, 2003
111
GB
Hi all

I've got quite a heavy traffic classic ASP site (I know it needs converting to .Net at some point) which runs fine 90% of the time but occasionally I get an error 'ASP 0115' Unexpected Error.
A trappable error (C0000005) occurred in an external object. The script cannot continue running.

This happens on every single page/Ajax call.

It happens consistently for around 20 minutes and then just vanishes.

For each page I am including a list of classes (literally <!--#include file="../classes/MyClass.asp"-->) and then creating a new version of my Database class (set cDB=new Database) which holds connection information etc. And killing it at the end of each page.

Searching online a lot of people with this error are blaming 3rd party components and objects, however I'm not using any. The only CreateObjects i have is one ADODB.Connection, several instances of ADODB.Recordset and I'm using the Scripting.FileSystemObject from time to time - although I don't think that can be causing the issue as it's used rarely.

Basically it's a massive site (33 classes and numerous controllers) so I'm not expecting anyone to error trap it for me! But I just don't know where to start looking to figure out the cause of this error. Can anyone offer any advice or point me in the right direction please?

Thanks

~S~
 
With AJAX, there will be a server and a client. Can you log what the server receives and the XML it sends out? Just write it to a file with a timestamp.

Do you still try to access the DB if it is unable to connect?
 
It's not getting far enough through the process when the error occurs. It's literally failing at the first line:

<%
set DB=new Database
%>

So it must be a problem in the Database class but without a line number or a proper error message to go on and I'm a bit stuck. I believe it's falling over trying to create the objects in class_initialize(). I know it sounds crazy but I think the problem is happening on creating either the ADODB.Connection or the Scripting.Dictionary. I've no idea what could cause this.

Code:
private sub class_initialize()
  set Me.Connection=Server.CreateObject("ADODB.Connection")
  set Me.Pages=Server.CreateObject("Scripting.Dictionary")
  '* Create a load more dictionary objects
  Me.Connect()

end sub

Currently the site is working totally fine again and as I'm unable to manually replicate the error I'm a bit stuck with any more to go on until the next time it happens :
~S~
 
In case this is useful to anyone else I traced the error down to the following line which is happening in class_initialize()

set m_Connection=CreateObject("ADODB.Connection")

For some strange reason the error was occurring when trying to set up the connection object. I think it must be to do with the connection not being closed properly within the same session (perhaps during a session timeout). To get around this problems (and this may not be the tidiest solution but it seems to work) I have changed the line to:

set m_Connection=nothing
set m_Connection=CreateObject("ADODB.Connection")

By first setting the object to nothing and then re-creating the object the error disappears.

~S~
 
Perhaps you should set it to nothing in the class_terminate, which is when the class is deleted.
 
Yes - I am, of course, already setting it to nothing in the class_terminate.

I am also setting the instance of the Database class itself to nothing at the end of each page to ensure the class_terminate is fired.

This is why it was such a peculiar error and I have had to put it down to the session timing out and somehow leaving the variable in memory.

Weird one. Never really got to the bottom of it but at least I found a workaround...

~S~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top