#1 2020-04-22 18:17:36

JD
Member
Registered: 2015-08-20
Posts: 101

[SOLVED] Problem connecting to server with latest mORMot

Hi there everyone,

I just updated to the latest version of mORMot dated 22/04/2020. I recompiled my principal mORMot project and to my surprise, I can no longer connect to the Lazarus server from a Lazarus client.

My code is as follows:

Client side:

fClient := TSQLHttpClient.Create(AnsiString(fClientSettings.HostOrIP), AnsiString(fClientSettings.Port), fModel, false, '', '', fConnectionSettings.SendTimeout, fConnectionSettings.ReceiveTimeout, fConnectionSettings.ConnectTimeout);
TSQLHttpClient(fClient).Compression := [hcSynShaAes];

The values above are:
fConnectionSettings.SendTimeout = 15000
fConnectionSettings.ReceiveTimeout = 15000
fConnectionSettings.ConnectTimeout = 20000

Server side:

fHTTPServer := TSQLHttpServer.Create(AnsiString(fServerSettings.Port), [fRestServer], '+', {HTTP_DEFAULT_MODE} useHttpSocket, 32, TSQLHttpServerSecurity.secSynShaAes);
THttpServer(fHTTPServer.HttpServer).ServerKeepAliveTimeOut := CONNECTION_TIMEOUT;

This code works perfectly with older versions of mORMot. It is patterned after the example of George, in the list of mORMot examples. I have no idea why it no longer works.

I would appreciate any help in the resolution of this problem.


By the way, I am using Lazarus 2.1/fpc 3.2 rc1 Win32.

Cheers,

JD

Last edited by JD (2020-04-27 11:38:27)

Offline

#2 2020-04-22 22:01:07

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

Re: [SOLVED] Problem connecting to server with latest mORMot

Perhaps due to https://synopse.info/fossil/info/434798ffa809f5a0 ?
Now THttpServer.WaitStarted is to be called after THttpServer.Create.

I am not able to reproduce any problem with the regression tests:

    1 x Intel(R) Core(TM) i3-7020U CPU @ 2.30GHz (x86)
Using mORMot 1.18.5960
    TSQLite3LibraryStatic 3.31.0 with internal MM
Generated with: Free Pascal 3.2 32 bit compiler

Time elapsed for all tests: 1m38
Performed 2020-04-22 23:59:03 by User on WindowsVM

Total assertions failed for all test suits:  0 / 44,405,114
 All tests passed successfully.

Please check with the TestSQL3.dpr to see if there is something wrong with something we can reproduce.

Offline

#3 2020-04-22 22:31:49

JD
Member
Registered: 2015-08-20
Posts: 101

Re: [SOLVED] Problem connecting to server with latest mORMot

Hi there ab,

I ran TestSQL3 and some assertions failed. Here are the relevant messages:

 1.2. Low level types:
  - RTTI: 1,340 assertions passed  1.71ms
  - Url encoding: 200 assertions passed  1.31ms
  - Encode decode JSON: 429,322 assertions passed  2.47s
  - Wiki markdown to html: 56 assertions passed  492us
  - Variants: 88 assertions passed  386us
  - Mustache renderer: 153 assertions passed  1.03s
  - TDocVariant: 91,785 assertions passed  235.03ms
!  - TDecimal128: 22 / 17,446 FAILED  21.26ms
  - BSON: 245,068 assertions passed  18.98ms
     100000 TBSONObjectID.ComputeNew in 8.79ms i.e. 11,372,682/s, aver. 0us
  - TSynTableStatement: 221 assertions passed  8.40ms
  - TSynMonitorUsage: 1,202 assertions passed  3.26ms
  Total failed: 22 / 786,881  - Low level types FAILED  3.82s
.........
.........
Windows 10 64bit (10.0.18363) (cp1252)
    4 x Intel(R) Core(TM) i3-3240 CPU @ 3.40GHz (x86)
Using mORMot 1.18.5960
    TSQLite3LibraryStatic 3.31.0 with internal MM
Generated with: Free Pascal 3.2 32 bit compiler

Time elapsed for all tests: 3m25
Performed 2020-04-23 00:26:57 by JD on DESKTOP-NPLKN1D

Total assertions failed for all test suits:  22 / 44,408,725
! Some tests FAILED: please correct the code.

JD

Last edited by JD (2020-04-22 22:35:27)

Offline

#4 2020-04-22 22:46:11

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

Re: [SOLVED] Problem connecting to server with latest mORMot

No Client/Server test failed.

Did you try that THttpServer.WaitStarted is to be called after THttpServer.Create.

Offline

#5 2020-04-22 23:03:49

JD
Member
Registered: 2015-08-20
Posts: 101

Re: [SOLVED] Problem connecting to server with latest mORMot

Hi ab,

This is what I did

fHTTPServer := TSQLHttpServer.Create(AnsiString(fServerSettings.Port), [fRestServer], '+', {HTTP_DEFAULT_MODE} useHttpSocket, 32, TSQLHttpServerSecurity.secSynShaAes);
THttpServer(fHTTPServer.HttpServer).WaitStarted();

It didn't work.

I can call my interface based services using my browser or an application like Postman but I can no longer connect to the server using a Lazarus client. This is what was happening even before the addition of THttpServer.WaitStarted.

JD

Last edited by JD (2020-04-22 23:08:43)

Offline

#6 2020-04-23 08:29:23

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

Re: [SOLVED] Problem connecting to server with latest mORMot

Did you try to disable Compression := [hcSynShaAes] ?

Offline

#7 2020-04-23 09:45:05

JD
Member
Registered: 2015-08-20
Posts: 101

Re: [SOLVED] Problem connecting to server with latest mORMot

ab wrote:

Did you try to disable Compression := [hcSynShaAes] ?

I just tried it. It did not work either. Can I upload the Heaptrc dump images? There are just 2 of them.

JD

Offline

#8 2020-04-23 09:50:05

JD
Member
Registered: 2015-08-20
Posts: 101

Re: [SOLVED] Problem connecting to server with latest mORMot

Here are the Heaptrc dump images from the server

https://pasteboard.co/J57uNZa.png

https://pasteboard.co/J57vcwf.png

Offline

#9 2020-04-23 09:59:05

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

Re: [SOLVED] Problem connecting to server with latest mORMot

Offline

#10 2020-04-24 15:40:34

JD
Member
Registered: 2015-08-20
Posts: 101

Re: [SOLVED] Problem connecting to server with latest mORMot

Hi there ab,

Sorry for the late reply. I have to apologize because I found the cause of the problem. It was a compiler directive that I disabled and had forgotten about in one of the source files. The end result was that the client and server were not using the same protocols. Everything now works perfectly.

Thank you very much for your time and for the suggestions you gave me.

JD

Last edited by JD (2020-04-25 06:43:47)

Offline

#11 2020-05-06 20:12:37

Gianluca
Member
Registered: 2017-01-10
Posts: 1

Re: [SOLVED] Problem connecting to server with latest mORMot

Hello everybody,

just because I'm experiencing the same issue with my client and server programs based on mormot and http server connection, I'm asking JD if you could be so kind to explain a little bit deeper the solution related to compiler directive. Hoping this could solve my problem too.

Many thanks for everything you can do.

Gianluca
Delphi XE5 Windows 10 win32

Offline

Board footer

Powered by FluxBB