#1 2019-07-15 11:55:47

PP
Member
Registered: 2019-07-15
Posts: 3

Remote Logger sample project fails with AV on exit

I have just installed the latest mORMot release to check its remote logging capabilities.

RemoteLoggingTest project built with Delphi 10.3.1 works fine, but … raises AV exception on exit (exception class $C0000005 with message 'access violation at 0x00000000: read of address 0x00000000').

It looks that the code breakes in TSynLogFamily.EchoRemoteStop in attempt to execute fEchoRemoteEvent which has been already set to nil but fEchoRemoteClientOwned remains true.

Offline

#2 2019-10-20 00:03:40

Micky60
Member
Registered: 2014-10-27
Posts: 2

Re: Remote Logger sample project fails with AV on exit

I met the same AV when trying to test the Remote Logging.

1. By using the RemoteLoggingTest to connect to the Remote Logger Server,  the reconnection will fail(Connect --> Disconnect --> Connect).
    It seems there is a bug in the following procedure:

procedure TSynLogFamily.EchoRemoteStop;
begin
  if fEchoRemoteClient=nil then    // testing fEchoRemoteClient
    exit;

   ........

  fEchoRemoteClient := nil;   // should be added
  fEchoRemoteEvent := nil;
end;

2. If the RemoteLoggingTest is still in Connection state, and try to close it, AV will ocure here:
 
procedure TSQLHttpClientGeneric.InternalURI(var Call: TSQLRestURIParams);
.....
begin
   ......
{$ifdef WITHLOG}
  with Call do     // AV occurs here, because procedure TSQLRestThread.Execute; calls InternalURI
    log.Log(sllClient,'% % status=% len=% state=%',
      [method,url,OutStatus,length(OutBody),OutInternalState],self);
{$endif}
end;

I don't know how to fix the second AV.  The program is in the process of closing, but the thread does not know that.

Offline

#3 2019-10-20 00:11:08

Micky60
Member
Registered: 2014-10-27
Posts: 2

Re: Remote Logger sample project fails with AV on exit

By adding the following procedure in the client side, the AV on exit can be fixed.

procedure TMainForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  btnDisconnectClick(Self);
  CanClose := True;
end;

Last edited by Micky60 (2019-10-20 00:13:24)

Offline

#4 2020-04-25 12:05:37

lagodny
Member
Registered: 2015-01-28
Posts: 50

Re: Remote Logger sample project fails with AV on exit

I ran into a similar problem.
The code is definitely missing:

fEchoRemoteClient: = nil;

in procedure TSynLogFamily.EchoRemoteStop;

@ab could you fix the code?

Offline

#5 2020-04-25 13:28:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,609
Website

Re: Remote Logger sample project fails with AV on exit

Offline

#6 2020-04-25 13:31:50

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,609
Website

Re: Remote Logger sample project fails with AV on exit

Offline

#7 2020-04-26 09:59:09

lagodny
Member
Registered: 2015-01-28
Posts: 50

Re: Remote Logger sample project fails with AV on exit

Thanks

Offline

Board footer

Powered by FluxBB