Icon View Incident Report

Serious Serious
Reported By: Fernando Dias
Reported On: 9/5/2008
For: Version 2.01 Build 4
# 2773 Closing Master Table in Master-Detail Link with Server Down and No OnReconnect Event Causes AV

I'm getting an AV when using 2 TEDBTables (Master-Detail connected) after a remote connection is lost. Again, it only happens when using remote connections.

How to reproduce:
1.Start EDB server and the demo application.
2.Click "Open"
3.Stop EDB server
4.Try to close "Form2". You will get the message
"ElevateDB Error #1101 The connection to the server at '127.0.0.1' has
been lost ('The reconnection was cancelled')"
5.Close "Form2"
6.Click "Close Database". You will get an AV.

Main
-----

procedure TMain.Button1Click(Sender: TObject);
begin
    Form2:=TForm2.Create(nil);
    try
      Form2.ShowModal;
    finally
      Form2.Free;
    end;
end;

procedure TMain.Button2Click(Sender: TObject);
begin
  EDBDatabase1.Close;
end;

Form2
-----

procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  edbtable1.close;
  edbtable2.close;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
  EDBTable1.Open;
  EDBTable2.Open;
end;



Comments Comments and Workarounds
This problem is being caused by the fact that the TDataSet component in Delphi does not wrap a cursor close in a try..finally to ensure that the proper cursor close methods are called even if an exception is raised. When the TDataSet component closes a table involved in a master-detail linkage, it will cause the range for the master-detail link to be cancelled. This operation is experiencing an exception in this case due to the server being gone, and that is preventing the cursor close methods from completing properly. When the database is then closed, there are references to the master table still present in the database component (TCustomConnection) even though the table is closed.

The workaround is to define an TEDBSession.OnRemoteReconnect event handler and set the Continue variable parameter to False. That will prevent the original exception from being raised during the range cancel that causes the problem.


Resolution Resolution
Fixed Problem on 9/6/2008 in version 2.01 build 5


Products Affected Products Affected
ElevateDB Additional Software and Utilities
ElevateDB VCL Client-Server
ElevateDB VCL Client-Server with Source
ElevateDB VCL Standard
ElevateDB VCL Standard with Source
ElevateDB VCL Trial

Image