Icon View Incident Report

Serious Serious
Reported By: Oliver Bock
Reported On: 2/16/2006
For: Version 4.22 Build 4
# 2163 Opening Multiple Databases in Server Procedure Can Cause Server Crash on Exit

I get a crash when:

CLIENT
1. Create a session.
2. Create a database.
3. Use a TDBISAMQuery to create a memory table.
4. Call a server procedure.
9. Destroy objects and exit.

SERVER (must be using FastMM 4.58 with full debug mode)
5. Receive the server procedure call.
6. Creates a TDBISAMDatabase using the session provided as a param.
7. Open a TDBISAMTable using the memory table.
8. Destroy the TDBISAMTable and TDBISAMDatabase.
10. Exit and crash.

Note that I only get the crash when FastMM is in use, and only when FullDebugMode is on.

Client:

var
   session: TDBISAMSession;
   database: TDBISAMDatabase;
   qry: TDBISAMQuery;

begin
   session := TDBISAMSession.Create(nil);
   session.AutoSessionName := True;
   session.SessionType := stRemote;        // set for c/server.
   session.RemoteHost := 'localhost';
   session.RemoteUser := 'Admin';
   session.RemotePassword := 'DBAdmin';
   session.RemoteCompression := 6;  // Required to speed up connections over
                                   // Internet. Hopefully not too slow for local
                                   // connections.  Detection of slow connection
                                   // would be better.
   session.Active := True;

   database := TDBISAMDatabase.Create(nil);
   database.SessionName := session.SessionName;
   database.RemoteDatabase := 'Sample';
   database.DatabaseName := 'Sample';
   database.Connected := True;

   qry := TDBISAMQuery.Create(nil);
   qry.SessionName := session.SessionName;
   qry.DatabaseName := database.DatabaseName;
   qry.SQL.Add('create table "\Memory\Key_Purpose"(i integer);');
   qry.ExecSQL;

   session.RemoteParams.Clear;
   session.CallRemoteProcedure('Test');

   qry.Destroy;
   database.Destroy;
   session.Destroy;
end.

Server:

type
   TServerHost = class
   private
      procedure ServerProcedure(Sender: TObject;
           ServerSession: TDBISAMSession; const ProcedureName: String);
   end;

procedure TServerHost.ServerProcedure(Sender: TObject;
  ServerSession: TDBISAMSession; const ProcedureName: String);
var
   t: TDBISAMTable;
   db: TDBISAMDatabase;
begin
   db := TDBISAMDatabase.Create(nil);
   db.SessionName := ServerSession.SessionName;
   db.RemoteDatabase := 'Sample';
   db.DatabaseName := 'Sample';
   db.Connected := True;

   t := TDBISAMTable.Create(nil);
   t.SessionName := db.SessionName;
   t.DatabaseName := 'Memory';
   t.TableName := 'Key_Purpose';
   t.Open;
   t.Free;

   db.Free;
end;

var
   host: TServerHost;

begin
   DeleteFile('dbsrvr.scf');
   host := TServerHost.Create;
   Engine.EngineType := etServer;
   Engine.OnServerProcedure := host.ServerProcedure;
   Engine.Active := True;
   Engine.AddServerProcedure('Test', '');
   Engine.AddServerDatabase('Sample', '', 'c:\Artful Ledgers\Sample');
   Application.CreateForm(TForm1, Form1);
   Application.Run;
end.



Resolution Resolution
Fixed Problem on 2/20/2006 in version 4.22 build 6


Products Affected Products Affected
DBISAM Additional Software and Utilities
DBISAM CLX Client-Server
DBISAM CLX Client-Server with Source
DBISAM CLX Standard
DBISAM CLX Standard with Source
DBISAM ODBC Client-Server
DBISAM ODBC Client-Server with Source
DBISAM ODBC Standard
DBISAM ODBC Standard with Source
DBISAM VCL Client-Server
DBISAM VCL Client-Server with Source
DBISAM VCL Standard
DBISAM VCL Standard with Source

Image