You are not logged in.
Pages: 1
mORMot2 (Version 2021/03/29), Windows 10, Delphi 10.4.2, 32 Bit
I used the TSynDaemon class with the following settings:
Settings.LogClass.Family.OnArchive := EventArchiveZip;
Settings.LogClass.Family.ArchiveAfterDays := 1;
First of all, I would like to mention that all files and directories are present and have the correct permissions.
When I exit the server, the process crashes. The following procedure will take place:
- TZipWrite.CreateFrom() is called. aFileName: ...\log\202103.zip
- TZipWrite.AddDeflated() with the first file is called. aFileName: ...\LogFile\S01\Server_20210330_122816.log
- TZipWrite.WriteHeader() with zipName: Server_20210330_122816.log
- TZipWrite.WriteRawHeader. It crashes when executing fDest.WriteBuffer(tmp.buf^, tmp.len);.
ThreadName="Main", ExceptionMessage="Stream-Schreibfehler", ExceptionName="EWriteError"
With best regards
Thomas
Last edited by tbo (2021-04-01 09:38:06)
Offline
The error has the following cause. In the function EventArchiveZip() TZipWrite.CreateFrom() is called. The function TZipWrite.CreateFrom() contains the following source code:
constructor TZipWrite.CreateFrom(
const aFileName, LastZipNameToIgnore: TFileName);
...
begin
h := FileOpen(aFileName, fmOpenReadWrite or fmShareDenyNone);
if not ValidHandle(h) then
begin
R := nil;
h := 0;
end
else
R := TZipRead.Create(h);
Create(h, aFileName);
...
If the zip file does not exist, no valid handle is returned by the FileOpen() function. When calling the constructor Create(h, aFileName) with an invalid handle, no FileStream is created. Attempting to write to a non-existent stream in TZipWrite.WriteRawHeader() with fDest.WriteBuffer results in a disaster.
With best regards
Thomas
Last edited by tbo (2021-04-01 17:51:46)
Offline
You are right.
Please try https://github.com/synopse/mORMot2/comm … e4528be0bd
Offline
You are right.
Please try https://github.com/synopse/mORMot2/comm … e4528be0bd
Compiler error with function FileCreate()
constructor TZipWrite.CreateFrom(
const aFileName, LastZipNameToIgnore: TFileName);
...
h := FileCreate(aFileName, fmOpenReadWrite or fmShareDenyNone);
In file mormot.core.os.windows.inc the function has the following format:
function FileCreate(const aFileName: TFileName): THandle;
With best regards
Thomas
Offline
Pages: 1