#1 2024-11-04 10:50:27

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

example httpServerFiles THttpProxyServer.destroy exception

Hi,

we're testing mormot2 and we found error in:

httpServermain.pas

    finally
      server.Free;  <== D12.2 throws error in same is with D11.3
    end;
  finally
    settings.Free;
  end;

D12:
destructor THttpProxyServer.Destroy;
begin
  if fServer <> nil then
    fServer.Shutdown; // set flag ASAP
  inherited Destroy; <==  exception


Exception :
     destructor TSynAutoCreateFields.Destroy;
     begin
       AutoDestroyFields(self); <== Exception
       inherited Destroy;
     end;
exception is:

---------------------------
GExperts Debugger Exception Notification
---------------------------
Project httpServerFiles.exe raised exception class EAccessViolation with message 'Access violation at address 00C69C88. Read of address 0000008C'.
---------------------------
[&Filter ...] [Ignore &All this Session] [&Break] [Additional &Info] [&Continue]
---------------------------
ThreadId=33732
ProcessId=14
ThreadName="Main"
ExceptionMessage="Access violation at address 00C69C88. Read of address 0000008C"
ExceptionName="EAccessViolation"
ExceptionDisplayName="$C0000005"
ExceptionAddress=00C69C88
FileName="C:\DEV\synopse\GitHub\mORMot2\src\core\mormot.core.json.pas"
LineNumber=11881

---------------------------

thank you

Offline

#2 2024-11-04 11:28:17

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

Re: example httpServerFiles THttpProxyServer.destroy exception

It does not make much sense with so little context.

Offline

#3 2024-11-04 11:54:17

VojkoCendak
Member
From: Celje Slovenia
Registered: 2012-09-02
Posts: 93

Re: example httpServerFiles THttpProxyServer.destroy exception

1. open example: httpServerFiles.dpr in mORMot2\ex\http-server-files
2. enter in Run paramateres: /folder "myfolder..."
3. run
4. hit enter
5. ... exception in server.Free;

Offline

#4 2024-11-04 13:13:24

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

Re: example httpServerFiles THttpProxyServer.destroy exception

Now I get it.

Please try by adding a missing call to the inherited constructor:

{ THttpProxyServer }

constructor THttpProxyServer.Create(aSettings: THttpProxyServerSettings);
begin
  inherited Create; // call TSynAutoCreateFields
  fLog := TSynLog;
...

Could you create a Pull Request with this fix?
I am not with my dev computer, because I am on holidays. wink

Offline

#5 2024-11-04 14:56:37

zen010101
Member
Registered: 2024-06-15
Posts: 66

Re: example httpServerFiles THttpProxyServer.destroy exception

ab wrote:

Could you create a Pull Request with this fix?
I am not with my dev computer, because I am on holidays. wink

Done

Offline

Board footer

Powered by FluxBB