Un-trappable errors!

I have a problem with un-trappable error messages. The two errors I’m seeing have separate causes.

Error 1: Disc I/O Error - caused by PostgreSQL loosing connection to the database due to a network disconnection.
Error 2: Error accessing 0X00… at memory 0X00… - unknown cause (the 0X00… refers to the memory reference.)

Perhaps this should be in two separate topics. The real problem though is that I get a blocking error message dialog in both cases.

Here is why it’s a problem.
My app is acting as a server to communicate with several (5-15) apps on the local network via TCP sockets. Is the server app is shut down all apps lose their ability to function, which is very serious. Blocking error messages keep TCP communications from continuing. For obvious reasons I can’t require user input on the server app. They way I handle things currently is to send all error messages back to the corresponding app via the TCP connection, or otherwise. For fatal unhandled errors I write the error including the stack trace to the database and quit the app. I also turn off windows error reporting and disable the error reporting UI. This allows the app to crash silently without any blocking dialogs. I have a server monitor app running in the background. When it’s TCP socket gets disconnected it automatically restarts the server app. In this way no matter what the error or even hard crash the server keeps going or restarts itself with no user input.

To reiterate I have not found a way to trap the above mentioned errors. This causes the app to block and no more communication can occur. Even worse the TCP connections still show connected, so my apps don’t know the connection is down (not responding).

The memory error is really causing me concern as it is very weird, and has no apparent cause. BTW I’m not using any declares but I and using the QuickBooks SDK.

Sorry for the long post (I know the first thing people do is ask for more details). Any ideas?

P.S. The QB SDK uses a lot of Ptr and COM. Here is a sample: (the exceptions shown here can be caught and handled)

[code]Sub BeginSession(qbFile_Param As String, openMode_Param As QBFC13Lib.ENOpenMode)
If mThis = Nil Then Raise New NilObjectException
Dim func As New BeginSession_Func2(mThis.Ptr( 0 ).Ptr(32 ))
Dim resultCode As Integer
Dim Local_qbFile_Param As Ptr
Local_qbFile_Param = COM.SysAllocString( qbFile_Param )
resultCode = func.Invoke(mThis, Local_qbFile_Param, openMode_Param)
COM.SysFreeString(Local_qbFile_Param)
If resultCode = 0 Then
Else // Throw Exception
Raise New COM.COMException(“Failed on BeginSession”, resultCode)
End If

End Sub[/code]

No ideas?

I’ve been wondering if I could ‘ping’ the server every two seconds and request a response. Then if no response is recieved I would need to somehow kill the running server app and restart it. Any ideas on how to kill an app and restart it from a second app?

UPDATE: The File I/O error is related to a SQLite database file, not PostgreSQL.

Sorry. After doing more research I found that the ‘disk I/O Error’ was an error message from the SQLiteDatabase object that I was displaying via a message box. Shame on me for not checking better.