#1 2018-10-26 08:37:10

fravemel
Member
Registered: 2018-08-08
Posts: 5

'External: SIGSEGV' sample "14 - Interface based services"

First of all, to say that altoug I've never use Mormot nor lazarus in production it looks great, my sincere thanks an admiration to ab and mormot community.

Im begining with mormot and Lazarus and I'm trying to run the sample project "14 - Interface based services" under windows 7 and windows 10 (NewPacal and Lazarus 2.1rc1 fpc 3.3.1) both tested and Mormot 1.8,
the project option TargetOS was specified linux processor x86_64 I change both to default and it seems to run
fine but when i close server pressing enter I get the exception 'External: SIGSEGV'
in line 1064 of mORMotHttpServer.pas.

procedure TSQLHttpServer.HttpThreadTerminate(Sender: TThread);
var i: integer;
begin
  if self=nil then
    exit;
  fDBServersSafe.Enter;
  try
    for i := 0 to high(fDBServers) do
      fDBServers[i].Server.EndCurrentThread(Sender);
  finally
    fDBServersSafe.Leave;
  end;
end;   

   

As In SynCommons  IAutoLocker  interface line 16509 says
      // - warning: under FPC, you should assign its result to a local variable -
      // see bug http://bugs.freepascal.org/view.php?id=26602   
it seems this bug only affects IAutolocker.ProtectMethod but when if I replace de previos method for:

   
var i: integer;
    Lock: IAutoLocker;
begin
  if self=nil then
    exit;
  Lock:= fDBServersSafe;
  Lock.Enter;
  try
    for i := 0 to high(fDBServers) do
      fDBServers[i].Server.EndCurrentThread(Sender);
  finally
    Lock.Leave;
  end;
end;  

   

The exceptions disappears.

I'm I wrong or this bug is affecting  IAutoLocker.Leave?
Should this be done in every occurrence of fDBServersSafe in TSQLHttpServer?
pardon my ignorance, but Is it advisable to use mormot/lazarus on windows in production or it should be use with delphi or under linux?

Thanks in advance.

Last edited by fravemel (2018-10-29 19:55:12)

Offline

#2 2018-10-26 20:49:13

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

Re: 'External: SIGSEGV' sample "14 - Interface based services"

We use mORMot + FPC on production for hosting high-performance Linux services.
And it works great!
See https://www.livemon.com

I never saw this problem.
It is pretty weird that fDBServersSafe is reset during this method call. It should not affect other occurences of fDBServersSafe for sure.
But on multi-threading, such weird things happens...
Perhaps a local variable could be used to let this work as expected, but I doubt this is the root cause of the problem.

Offline

#3 2018-10-27 14:24:25

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,547
Website

Re: 'External: SIGSEGV' sample "14 - Interface based services"

May be this is again because of changes in FPC? @fravemel - what version of FPC compiler do you use? (including svn revision if this is trunk)

Offline

#4 2018-10-29 11:33:50

fravemel
Member
Registered: 2018-08-08
Posts: 5

Re: 'External: SIGSEGV' sample "14 - Interface based services"

Lazarus 2.1.0 r59308 FPC 3.3.1 x86_64-win64-win32/win64
Free Pascal Compiler version 3.3.1-r39946 [2018/10/16] for x86_64
and
Newpacal:
Lazarus 1.9.0 re61a6e98658a657348e26974b930483b8f2b87c2 FPC 3.1.1 x86_64-win64-win32/win64
Free Pascal Compiler version 3.1.1-r18972f561935ea1317692f81bbc5f476a8852a3f [2018/08/13] for x86_64

I isntalled them via fpcupdeluxe
In both cases I got the same exception.

Offline

Board footer

Powered by FluxBB