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

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,504
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: 230

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: 43

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: 13,504
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: 43

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: 230

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: 13,504
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: 13,504
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,401
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: 43

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: 13,504
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: 195

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: 140

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: 13,504
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: 230

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: 230

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: 13,504
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: 230

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: 13,504
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: 203

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,401
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: 13,504
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 Yesterday 06:44:15

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

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 Yesterday 08:13:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,504
Website

Re: mORMot 2 Release Candidate

You are right.

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

Thanks for the report.

Offline

#25 Yesterday 10:08:55

sakura
Member
From: Germany
Registered: 2018-02-21
Posts: 203

Re: mORMot 2 Release Candidate

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

Offline

#26 Yesterday 10:50:40

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

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 Yesterday 11:17:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 13,504
Website

Re: mORMot 2 Release Candidate

Offline

Board footer

Powered by FluxBB