Poor handling of connection loss

Sonique

Member²
With DOA 3.3.1, loss of connection is not handled terribly well. The problem is that the majority of OCI calls are made without first checking the validity of the handles which are passed in. To demonstrate, build an app with a TOracleSession and TOracleData component tied to a data source and a DB grid. Connect to the session to a remote DB, and set the dataset SQL to 'select * from all_objects' and set QueryAllRecords to False.

After the grid has been (partially) populated, disconnect your network cable, then try to scroll past the end of records currently fetched. After a small timeout, an ORA-03113 exception is raised (as expected). The problem is that a subsequent attempt to scroll causes an AV in OraClient8.dll, due to the fact that the statement handle is passed into OCIStmtFetch is invalid.

It gets worse - if the session has been disconnected by the client app, then nil statement handles are passed into OCI (with the same result). To see this, drop a TOracleQuery on the form, and add the following code to a buttonclick:

OracleQuery1.Session := OracleSession1;
OracleQuery1.SQL := 'select * from emp';
OracleQuery1.Execute;
OracleSession1.Connected := False;
ShowMessage(IntToStr(OracleQuery1.RowsProcessed));

Is this issue likely to be fixed in a future release?
 
The RowsProcessed AV can be fixed of course, it should simply check for a nil pointer. I'm not sure about the other issue though. We'll have to check if it is possible to determine if an OCI8 handle is invalid. If we can't determine this, then the AV in oraclient8.dll is really a Net8 problem.

------------------
Marco Kalter
Allround Automations
 
Back
Top