Icon View Incident Report

Serious Serious
Reported By: Wilko Frenzel [Aagon GmbH]
Reported On: 10/24/2022
For: Version 2.36 Build 1
# 4903 .Old Backup Files Cannot Be Deleted if Global File I/O Buffering Enabled

We recently enabled BufferedFileIO with the following settings:

Add('*.*,1,1,0,False');
Add('*.EDBTbl,4,8,1,False');

Now we have the case that after dropping a database (we use them for temporary storage of database query results) there is still a file open with the extension EBDCat.Old) which prevents deleting the directory. Only when the application is being closed this file disappears.

//To repro please create an empty VCL application and drop a TEDBEngine, TEDBSession, TEDBDatabase and a TButton onto the form.
//Into the ButtonClick event put the following code:

const
  TempDir = '.\SomeTempDir';
  TableDir = TempDir + '\DBTables';
var
  LTableDir: string;
begin
  EDBEngine1.ConfigPath := TempDir;
  EDBEngine1.BufferedFileIO := True;
  with EDBEngine1.BufferedFileIOSettings do
  begin
    Add('*.*,1,1,0,False');
    Add('*.EDBTbl,4,8,1,False');
 end;

  ForceDirectories(TableDir);

  EDBSession1.SessionName := 'SomeSessionName';
  EDBSession1.LoginUser := 'Administrator';
  EDBSession1.LoginPassword := 'EDBDefault';
  EDBSession1.KeepConnections := False;

  EDBDatabase1 := TEDBDatabase.Create(nil);
  EDBDatabase1.SessionName := EDBSession1.SessionName;
  EDBDatabase1.Database := 'SomeDatabaseName';
  EDBDatabase1.DatabaseName := EDBDatabase1.Database;
  EDBDatabase1.KeepConnection := False;

  LTableDir := TPath.Combine(ExtractFileDir(ParamStr(0)), TableDir);

  EDBDatabase1.Session.Execute('CREATE DATABASE "' + EDBDatabase1.DatabaseName + '"' +
    sLineBreak + 'PATH ' + QuotedStr(LTableDir) + sLineBreak);
  EDBDatabase1.Open;

  EDBDatabase1.Execute('CREATE TABLE SomeTable (SomeId GUID)');
  EDBDatabase1.CloseDataSets;
  EDBDatabase1.Close;

  EDBDatabase1.Session.Execute('DROP DATABASE "' + EDBDatabase1.DatabaseName + '"');

  // at this point if you look into .\SomeTempDir\DBTables there still exists
  // the EDBDatabase.EDBCat.Old and its being opened by the application
  // that means the following will fail (return false)

  // with EDBEngine1.BufferedFileIO := False the file is also there but not open anymore so the recursive delete succeeds

  TDirectory.Delete(TableDir, True);
end;



Resolution Resolution
Fixed Problem on 1/6/2023 in version 2.36 build 3


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

Image