#1 2023-01-09 15:40:31

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

mORMot 2 Release Candidate

The mORMot 2 framework is about to be released as its first 2.0 stable version.

I am currently working on preliminary documentation.
Some first shot here https://synopse.info/files/doc/mORMot2.html
At least we can use SynProject to generate it.

The framework feature set should now be considered as sealed for this release.
There is no issue reported opened at https://github.com/synopse/mORMot2/issues or in the forum.

Please test it, and give here some feedback to fix any problem before the actual release!
We enter a framework code-freeze phase until then.
smile
mORMot2-small.png

I have refactored the forum topics, so a new dedicated "mORMot 2" forum is to be used.
https://synopse.info/forum/viewforum.php?id=24
The previous forum was renamed "mORMot 1" and should now be used only about this former version, which is now considered in maintenance-only mode.

Blog article of this forum thread:
https://blog.synopse.info/?post/2023/01 … -Candidate

Offline

#2 2023-01-10 05:25:44

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: mORMot 2 Release Candidate

ab wrote:

Please test it, and give here some feedback to fix any problem before the actual release!

Some tips.

1. In configuration as below, where one REST registered in http and https servers, websockets works only for last registered server (HttpsServer in that case).
It may be fixed (can be difficult) or at least documented.

var
  Server: TRestServerFullMemory;
  HttpServer: TRestHttpServer;
  HttpsServer: TRestHttpServer;
begin
  Server := TRestServerFullMemory.CreateWithOwnModel([]);
  HttpServer := TRestHttpServer.Create('80', [Server], ...);
  HttpServer.WebSocketsEnable(Server, '').
  HttpsServer := TRestHttpServer.Create('443', [Server], ...);
  HttpsServer.WebSocketsEnable(Server, '').
end;

2. Next, in TRestServerUriContext.FillInput I changed limit from 128 parameters to 512 parameters, because I use DataTables Javascript library (https://datatables.net/). And it uses up to a dozen parameters per table column. So 128 is not enough.

Offline

#3 2023-01-10 05:58:01

Alek
Member
From: Russia
Registered: 2014-07-04
Posts: 44

Re: mORMot 2 Release Candidate

I have a problem with TRestHttpServer too

This is my test code (mORMot1 is Ok, mORMot2 is fail)

https://gist.github.com/delphiapp/95640 … 858068f326

The line where is a problem - 884 mormot.rest.http.server;

  log.Log(sllHttp, '% initialized for %', [fHttpServer, fDBServerNames], self);

Last edited by Alek (2023-01-10 06:11:46)

Offline

#4 2023-01-10 08:23:28

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

Re: mORMot 2 Release Candidate

Thanks a lot for your input!

@Chaa

1. It is already documented as such I guess: WebSocketsEnable() "defines the WebSockets protocols used by useBidirSocket/useBidirAsync"'.
It means that WebSocketsEnable requires a websockets-enabled kind of server, i.e. one HTTP_BIDIR mode, whereas without any option it uses HTTP_DEFAULT_MODE on Windows, which is http.sys (useHttpApiRegisteringURI) so is not websockets-ready.
You need to specify WEBSOCKETS_DEFAULT_MODE for both HttpServer instances.
I have made the exception more explicit https://github.com/synopse/mORMot2/commit/e20140c9

2. See https://github.com/synopse/mORMot2/commit/52e33fdc

@Alek
I can't reproduce your problem with your gist. The project runs with no problem.
Even if I add   TSynLog.Family.Level := LOG_VERBOSE;  at the begining. And I get the expected logs.
Please define what "fail" means in your case, and which compiler and system you use.

Offline

#5 2023-01-10 08:42:03

Alek
Member
From: Russia
Registered: 2014-07-04
Posts: 44

Re: mORMot 2 Release Candidate

I used Delphi 2006 Compiler and Stable Lazarus 2.2.4 Win32. In mORMot2 I got Access Violation from adress $00000000 when the programm is started

I have added compilation capability in Lazarus

https://gist.github.com/delphiapp/4450f … fcb4825e11

Offline

#6 2023-01-10 08:51:03

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: mORMot 2 Release Candidate

ab wrote:

It means that WebSocketsEnable requires a websockets-enabled kind of server, i.e. one HTTP_BIDIR mode

In previous example I use two useBidirSocket servers, one for HTTP, and one for HTTPS. But REST-server NotifyCallback can be used only with one useBidirSocket server (last registered).

Also, ConnectionID of those two useBidirSocket servers is the same, so we can not distinguish between them in IsActiveWebSocket, even if we can call NotifyCallback of all HTTP-servers.

Offline

#7 2023-01-10 09:26:23

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

Re: mORMot 2 Release Candidate

@Chaa
Now I understand.
This is indeed a limitation, but in practice, you should redirect all HTTP traffic to HTTPS. So the server on port 80 should just redirect to the other server on port 443.

I have documented this limitation.
And it will now raise an explicit exception in such case:
https://github.com/synopse/mORMot2/commit/09eb71a3

Offline

#8 2023-01-10 09:35:00

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

Re: mORMot 2 Release Candidate

@Alek
Now I can reproduce the problem.

Should be fixed by https://github.com/synopse/mORMot2/commit/a8df75ae

Offline

#9 2023-01-10 11:42:07

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

Re: mORMot 2 Release Candidate

Chaa wrote:

2. Next, in TRestServerUriContext.FillInput I changed limit from 128 parameters to 512 parameters, because I use DataTables Javascript library (https://datatables.net/). And it uses up to a dozen parameters per table column. So 128 is not enough.

On the real life the URL length is limited (by web browser, by proxies, by CDNs etc).  I've encountered such limitation several times. The best practice is to keep URL length < 2000 (so 128 parameters is far enough IMHO).

Offline

#10 2023-01-10 12:55:46

Alek
Member
From: Russia
Registered: 2014-07-04
Posts: 44

Re: mORMot 2 Release Candidate

Another unsolved problem is the incorrect operation of the _ObjArrayClear function

I also get access violation

https://gist.github.com/delphiapp/33c66 … e87c51c4cf

because  line 5822 file mormot.core.rtti is
    RawObjectsClear(pointer(V), PDALen(PAnsiChar(V^) - _DALEN)^ + _DAOFF); in this function
must be
    RawObjectsClear(V^, PDALen(PAnsiChar(V^) - _DALEN)^ + _DAOFF);

Offline

#11 2023-01-10 13:40:02

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

Re: mORMot 2 Release Candidate

@Alek
You are right.

Should be fixed now with
https://github.com/synopse/mORMot2/commit/4dc828fc

Sorry for having missed this.

Offline

#12 2023-01-10 19:35:19

igors233
Member
Registered: 2012-09-10
Posts: 241

Re: mORMot 2 Release Candidate

It would probably be a good idea to update https://synopse.info/fossil/wiki?name=Downloads page and to include m2 info/links and m2 NightlyBuild.

Offline

#13 2023-01-10 20:03:01

George
Member
Registered: 2016-04-05
Posts: 142

Re: mORMot 2 Release Candidate

AB, congratulations on reaching the milestone!

Synopse mORMot 2 is an Open Source Client-Server ORM SOA MVC framework for Delphi 7 up to Delphi 11 Alexandria and FPC 3.2/trunk, targeting Windows/Linux/BSD/MacOS for servers, and any platform for clients (including mobile or AJAX).

Does it mean, that mORMot2 supports Delphi 11 Linux compiler?

UPD:   
'Kylix or Delphi for MacOS/Linux/Mobile are unsupported'
'-> we recommend using FPC for POSIX platforms'

Last edited by George (2023-01-10 21:16:30)

Offline

#14 2023-01-10 21:17:15

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

Re: mORMot 2 Release Candidate

@Igor
I think I will suspend the whole fossil/wiki part, and let it dedicated to mORMot 1.
The new website will only link directly the forum and the github repository.
Perhaps some gitpages for the presentation itself in the future...

@George
No, it means that it supports Linux with FPC.
I don't have any Delphi for Linux license, so I can't make any adaptation.
And from what I have heard, the FPC support is much better for Linux than Delphi, and we got tremendous performance with FPC on Linux.

Offline

#15 2023-01-11 03:44:22

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: mORMot 2 Release Candidate

mpv wrote:

On the real life the URL length is limited (by web browser, by proxies, by CDNs etc).  I've encountered such limitation several times. The best practice is to keep URL length < 2000 (so 128 parameters is far enough IMHO).

Yes, for GET requests parameters is limited to 2000-4000 bytes, but for POST there is no such limits (DataTables uses POST).

Offline

#16 2023-01-12 03:35:59

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: mORMot 2 Release Candidate

Can we make PostgreSQL pipelining optional (in mormot.db.raw.postgres.pas)?

My problem: I create Windows 32-bit application, and use 32-bit libpq.dll. But 32-bit builds available only up to version 12, and has no pipelining support.
Version 14 with pipelining support has only 64-bit builds.

So now I changed ESqlDBPostgres to nil in call to Resolve.

May be there is a 32-bit libpq.dll with pipelining?

Offline

#17 2023-01-12 07:58:13

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

Re: mORMot 2 Release Candidate

@@Chaa
Please try https://github.com/synopse/mORMot2/commit/3cebbb39
Pipelining is used only manually, not from the ORM.
Now it should raise an exception only when EnterPipelineMode is called and the API does not support it.

Offline

#18 2023-01-12 08:58:12

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: mORMot 2 Release Candidate

Variable "raiseonfailure" is not initialized to ESqlDBPostgres on function start.

Offline

#19 2023-01-12 08:59:24

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

Re: mORMot 2 Release Candidate

Yes, it was fixed in-between by a later commit.

Offline

#20 2023-01-12 14:39:21

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 239
Website

Re: mORMot 2 Release Candidate

Hi Arnaud,

in mormot.db.core, you define _ENDCLAUSE (line 2410) with different options, suche as left, right, ..., how about adding WHERE itself? Would make it easier, when we build a where clause, that could be used in different contexts.

Regards,
Daniel

Offline

#21 2023-01-24 18:41:13

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

Re: mORMot 2 Release Candidate

BTW - names for TDynArraySortCompare SortDynArray* functions family (SortDynArrayInt64, ....) are very confusing (DynArray part in name).  I understand such naming reason - it's because of FPC TListSortCompare naming, but in fact these functions not related to DynArray at all and can compare not only DynArray elements, and not only for sorting purpose, right?

May be (before mORMot2 is not released) rename all of them to Compare* (CompareInt64, ...) and family itself to TCompare. Or TfnCompare ->  fnCompareInt64, fnCompareQWord etc to prevent possible conflicts.

Offline

#22 2023-01-24 18:49:03

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

Re: mORMot 2 Release Candidate

DynArray*() functions are really used in the TDynArray context.
They share the same parameters signature, as needed by TDynArray, which is of untyped const kind, i.e. something opaque always passed by reference:
TDynArraySortCompare = function(const A, B): integer;       

There are already CompareInt64() and such functions, which properly inline when needed, and which have the actual parameter types (e.g. Int64 for CompareInt64).

Offline

#23 2023-02-07 06:44:15

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: mORMot 2 Release Candidate

In 64-bit Linux type THandle cannot be used in resource management functions, because it's 32-bit file handle, but HInstance handles are 64-bit. This leads to Access Violation error. We must use PtrUInt (or TLibHandle) instead.

I see problems in:
ResourceToRawByteString, ResourceSynLZToRawByteString, TExecutableResource, TSynTimeZone, TZipRead.

Offline

#24 2023-02-07 08:13:16

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

Re: mORMot 2 Release Candidate

You are right.

Please try https://github.com/synopse/mORMot2/commit/701d8570

Thanks for the report.

Offline

#25 2023-02-07 10:08:55

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 239
Website

Re: mORMot 2 Release Candidate

Pointing out request in #20 again :-)
https://synopse.info/forum/viewtopic.ph … 842#p38842

Offline

#26 2023-02-07 10:50:40

Chaa
Member
Registered: 2011-03-26
Posts: 249

Re: mORMot 2 Release Candidate

Thank's, now it works.

But there's another problem after I updated mORMot:
Before, I changed FavIcon by assigning TRestHttpServer.FavIcon property.
Now, after adding URI routing, if I try to call HttpServer.SetFavIcon, there is an exception EUriRouter with message 'TUriRouter.Setup('/favicon.ico'): already registered'.
So, I not see the way of how to change FavIcon.

Offline

#27 2023-02-07 11:17:00

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

Re: mORMot 2 Release Candidate

Offline

#28 2023-02-15 22:12:05

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

Re: mORMot 2 Release Candidate

@ab - one request for future mORMot2 release - please, compress static in mormot2 release using tar.gz. 7z is not available in default distribution (on both Linux and Windows), and installing p7zip package, for example inside docker build as we do in TFB bench, just to decompress  mormot2static.7z  takes some time, and worst what it require internet connection - I sometimes have problem with Internet after missile attacks sad

Last edited by mpv (2023-02-15 22:13:01)

Offline

#29 2023-03-06 13:03:06

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

Re: mORMot 2 Release Candidate

The mORMot 2 official release is out!
cool

In fact, the RC standed for almost two months, and we eventually added some new features, like LDAP and DNS clients.
And a lot of optimizations to the web servers.

@mpv
I have now compressed the static into both .7z and .tgz format.
It is clearly more convenient on POSIX to have a .tgz content, and on Windows, I guess the .7z format is likely to be available on the developer system.

Please check
https://github.com/synopse/mORMot2/rele … 2.0.stable

Offline

#30 2023-03-06 15:38:23

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

Re: mORMot 2 Release Candidate

Congratulations with release and BIG thanks for your hard work!

Offline

#31 2023-03-06 15:51:39

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 430

Re: mORMot 2 Release Candidate

Congratulations!!! Many many thanks for your work

Offline

#32 2023-03-06 18:32:15

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

Re: mORMot 2 Release Candidate

A lot of waiting, but at least, we have increased the version number to 2.1.

The easiest may be perhaps to follow more or less the SQLite3 release time.
So I guess we will release 2.1.stable some weeks after SQlite3 will be released as 3.42.0 version. wink

Offline

#33 2023-03-07 04:38:40

cybexr
Member
Registered: 2016-09-14
Posts: 81

Re: mORMot 2 Release Candidate

Congratulations!!!  thank you ab!

Offline

#34 2023-03-07 06:11:43

wfbhappy
Member
Registered: 2022-02-16
Posts: 4

Re: mORMot 2 Release Candidate

厉害

Offline

#35 2023-03-09 11:12:15

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

Re: mORMot 2 Release Candidate

@ab - a see you adding an LDAP client. Just a note - I switch to libldap (on both Win/Lin) ~5 years ago - this is the only implementation what I fund what works correctly with ADFS. And most enterprises uses ADFS. Do not remember yet what exactly should be done to support LDAP in federation mode - may be additional steps for selecting active LDAP server from pool etc. - libldap solves this out from the box

Offline

Board footer

Powered by FluxBB