#1 Re: mORMot Framework » regression for Variants in commits after 96c8a5d3 » 2022-03-24 18:45:34


I've tested your changes and it works in my project without issues.

#2 mORMot Framework » regression for Variants in commits after 96c8a5d3 » 2022-03-23 10:42:22

Replies: 3

Hello Arnaud,

this code doesn't work with a commit later than 96c8a5d3 (2022-02-12):

  aCCGID: Integer;

V:= _OBJ([]);
aCCGID:= 1;

Debugger shows a EJsonException instead of a parsed json.

(Windows11, Delphi 10.4, 32/64bit)


#3 Re: mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-12 06:34:17

Ctxt.OutContent is perfectly identical (mORMot1 vs. mORMot2)! Not what I expected.

Seems to be a wrong content-length in http header. How can I check this value? In Ctxt I haven't found it?

As a side note, content won't parsed under mORMot2 by

_Json(JSON, Result, [dvoReturnNullForUnknownProperty, dvoAllowDoubleValue, dvoValueCopiedByReference]);
--> var JSON: RawUTF8, Result: Variant)

whereas under mORMot1 it will.

#4 Re: mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-12 04:51:34

I've looked for tools for that too and under linux there are also xxd and vimdiff or colordiff.

#5 Re: mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-11 14:57:33

at Service level Result is ok, in Http.Request Ctxt.OutContent is wrong often (not always).
Although length of Ctxt.OutContent is correct, you can't convert Ctxt.OutContent to _JSON (json is invalid here).

With mORMot1 length is the same as under mORMot2, but you can convert Ctxt.OutContent to _JSON without error.

In TBaseWriter.AddNoJsonEscape P can't parsed to json with _Json (TDocVariantData(Value).InitJson(Json, Options) gives false), but P parsed with JSON-Lint says "valid json"

I've to compare the P (mORMot1<>2) tomorrow.

#6 Re: mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-11 13:45:04

error still occurs after last update (14d8508bf1578e996542c44887e63efe91115972).

Ctxt.OutContent is not smaller, it's bigger, but seems to be wrong (when I can trust the Browsers).

I will follow your advices and give feedback...

#7 Re: mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-11 12:50:37

1. Yes I'm using a reverse proxy (apache2) from the beginning of my career.

Length of Res (Service-Result) = 123579733
Length of Ctxt.OutContent = 123579746 (this is +13 of 123579733 (because of +'{"result":[]}' what's correct))

No, no sockets

4. No exceptions, only in Client(Browser) with ERR_CONTENT_LENGTH_MISMATCH

PS: a Length of 28403957 works, but this is just an example, not a gap

#8 Re: mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-11 11:59:51

result := inherited Request(Ctxt);

in HttpServer.Request from a service call with standard RawJSON result (result:[JSON-Content from Service])

#9 Re: mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-11 11:33:19

Same configuration, absolute no changes.
We are using mORMot2 for production since 2-3 weeks and all works well. This error comes some days ago. I don't thought about mORMot2 but WLAN/network issues.
But this comes definitely from/with mORMot2 but just for larger responses, small one works fine.

Thanks for your great work again!

PS: for jit I personally would prefer BESEN. What I've seen and heart from bero simply destroys my self-confidence

#10 mORMot Framework » ERR_CONTENT_LENGTH_MISMATCH using mORMot2 » 2021-08-11 08:32:20

Replies: 15

Hi ab,

under Win64 (XE6) I got this error in all Browsers (Safari, Chrome, Firefox) at xhr response for big contents.
With mORMot(1.18) there is no such error.
Are there options I've to set for mORMot2?

Do you further informations?


#11 mORMot Framework » Count of Names/Values of TDocVariantData » 2021-07-24 14:06:27

Replies: 2

mORMot.core.variants set length to 16 (although real number of fields in json is lower e.g. 11).
Is it an error when Length(TDocVariantData.Names)-1 or High(TDocVariantData.Names) gives 15 or isn't it allowed to access Names/Values with mORMot2?

#13 Re: mORMot Framework » Dangerous IgnoreSSLCertificateErrors defaults » 2021-07-21 10:43:02

TMongoConnection.Open were the right place, but constructor hasn't a param for it.

#14 Re: mORMot Framework » Dangerous IgnoreSSLCertificateErrors defaults » 2021-07-19 16:24:34

Where can I set IgnoreSSLCertificateErrors to true for MongoClient?

#15 Re: mORMot Framework » Exception with external DB access » 2021-05-04 14:23:55

Did you call MapField('ID', 'YourExternalPrimaryKeyIDField')?

#16 Re: mORMot Framework » linker issue under linux with static libs » 2021-04-26 10:46:22

You also shouldn't drink alcohol. But sometimes it's worth doing it.

#18 Re: mORMot Framework » linker issue under linux with static libs » 2021-04-26 08:52:13

Thanks @mpv and @ab.

I had to disable

{.$L static/x86_64-linux/sha512-x64sse4.o}
{.$L static/x86_64-linux/crc32c64.o}

in SynCrypto.pas.

Now the linker is happy again

#19 Re: mORMot Framework » linker issue under linux with static libs » 2021-04-26 07:36:34

LD_LIBRARY_PATH was empty. I've set it to /home/daniel/mORMot2/static/x86_64-linux where sha512-x64sse4.o and others are located, but same errors.
My guess is that it comes from mixing mORMot with mORMot2. I've also tried to replace SynCrypto but its also used in mORMot.pas.

There seems to be a declaration of a variable or function in a header file, which is included in more than one *.c file.

#20 mORMot Framework » linker issue under linux with static libs » 2021-04-25 19:00:32

Replies: 9

I'm using mORMot but for OpenSslVerify I've used mormon.crypt.openssl from mORMot2 with actual static libs from get_latest_static.sh.
After compiling following error comes from linker:

Linking fpc/bin/x86_64-linux/SOneSrv
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/sha512-x64sse4.o: in function `sha512_sse4':
(.text+0x0): multiple definition of `sha512_sse4'; static/x86_64-linux/sha512-x64sse4.o:(.text+0x0): first defined here
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/crc32c64.o: in function `crc32_iscsi_01':
(.text+0x0): multiple definition of `crc32_iscsi_01'; static/x86_64-linux/crc32c64.o:(.text+0x0): first defined here
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/crc32c64.o: in function `crc32_iscsi_01_slver_01030015':
(.text+0x1566): multiple definition of `crc32_iscsi_01_slver_01030015'; static/x86_64-linux/crc32c64.o:(.text+0x1566): first defined here
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/crc32c64.o: in function `crc32_iscsi_01_slver_01030015':
(.text+0x1566): multiple definition of `crc32_iscsi_01_slver'; static/x86_64-linux/crc32c64.o:(.text+0x1566): first defined here
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping

mORMot2/test/build_fpc.sh compiles and links without errors.

#21 Re: mORMot Framework » Grace is an idea for mORMot - upgrade server with zero downtime » 2021-04-22 12:02:44

VPS, VDS  and Dedicated.

Dedicated is really cheap (ca. 300 EUR p.m.).
For a mongo shared cluster with 9 machines I'm using VPS-L SSD (14,99 per machine p.m.). This works stable but for production I should use VDS instead.

#23 mORMot Framework » Thx for TCrtSocket » 2021-04-18 14:26:13

Replies: 1

Hi Arnaud,

I just want to say thank you for this great class. It helped me implementing a client for EPSON fiscal server!


#24 Re: mORMot Framework » possible to connect to atlas shared? » 2020-11-01 16:45:44

I've made another pull request for using all connections of a cluster.

#25 Re: mORMot Framework » possible to connect to atlas shared? » 2020-11-01 13:39:04

I've made a pull request on GitHub #326 to read from Slaves:

MongoDB.Client.Connections[0].RunCommand('DatabaseName', Command, Res, [mqfSlaveOk]);

#26 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-27 10:53:38

But nevertheless I need the possibility for TMongoDatase.RunCommand to select the Databasename over a param.

Otherwise the OpenAuth should do the trick and use the admin database in background.

#28 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-27 08:21:07

Now it seems to work. After getting SEC_I_INCOMPLETE_CREDENTIALS I run InitializeSecurityContext again and get SEC_I_CONTINUE_NEEDED (as at using M0 version of Atlas).

#29 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-27 06:53:27

TLS version isn't the issue. I've turned back to TLS 1.0 in Atlas and cannot do OpenAuth

When I use free version (M0) in HandshakeLoop (1740) res has 590610 ($00090312).
With M10 res has 590624 ($00090320) -> SEC_I_INCOMPLETE_CREDENTIALS?

Possible this link could help?
https://stackoverflow.com/questions/474 … als-unexpe

Sorry, now I've seen your comment in SynWinSock (1748)! This is what I need here.

#30 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-26 15:27:19

After upgrade M0 to M10 I cannot do OpenAuth (Error in SynWinSock at 1709 -> HandshakeLoop(aSocket).

The connectionstring hasn't changed generally, but replica set members got different url's (after upgrade to M10).

In server log I've found ->DisabledProtocols: "TLS1_0,TLS1_1"

Any ideas?

#31 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-26 10:14:24

It seem to work. I can connect, authenticate, insert documents and aggregate them.

But how can I change the Database? The logic is actually OpenAuth and get a Database. Make request on the returned database. But OpenAuth needs database admin?

#32 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-26 09:43:58

With current mORMot I get an Exception in 5455 SynMongoDB (Header fields are all 0).

#33 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-26 09:29:00

9482 from 2020-06-17
I'll try current version and give you a feedback.

But for cluster we have to use DNS -type=SRV to get the IPs of the replica members. For Windows there is a function in windns.h.

#34 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-25 17:58:08

Now I've understand the field SecondaryHostCSV and looked at the older driver connectionstrings.

There are 3 connections for the replicaSet and mORMot has 3 connections within the TMongoClient.

AuthSource should be admin. OpenAuth seems to work. I got a Database returned.
Now I Database.Client.Connections[0].RunCommand('RealDB',BSONVariant('{aggregate:"revenuesSalesOrders",pipeline:[{$match:{TaskTypeID:2}},],cursor:{}}'),v1);

Here it hangs at line

if not fSocket.TrySockRecv(@Header,HeaderLen) then (procedure TMongoConnection.GetReply(Request: TMongoRequest; out result: TMongoReply))

It would be a very nice, if mORMot could connect to Atlas because for a Share I've to work with 9 machines.

Perhaps you are willing to implement it?

#35 Re: mORMot Framework » possible to connect to atlas shared? » 2020-10-25 16:52:38

Now I can connect, but Command to Database results in

'{"ok":0,"errmsg":"user is not allowed to do action [find] on [Rottler.revenuesSalesOrders]","code":8000,"codeName":"AtlasError"}'

but user is Admin and definitely able to to this.

Is there anything other to note or does Database:= OpenAuth() and Database.RunCommand should be enough?

#36 mORMot Framework » possible to connect to atlas shared? » 2020-10-25 16:28:27

Replies: 15

Hi Arnaud,

is mORMot prepared for this?

I got a connection but auth isn't possible (code 8000).

Connecting with mongo shell shows connecting to 3 servers (1 primary and 2 secondaries)


connectionstring should be:


I've set hostname to xxxx-shard-00-00.yahvx.mongodb.net
and then OpenAuth('dbname', 'username', 'pass')

but I don't know if this is ok.


#37 Re: mORMot Framework » Today i decided to upgrade to last build, now my code is not working » 2020-06-13 17:26:47

No, it wasn’t a joke.
We are using MongoDB but atm without auth.  But in future Atlas would be an option and it was impressive how fast you are finding the solution and I wanted to donate to honor your work. I don’t know if your account number has changed and PayPal isn’t optimal for me. If you want you can send it per email...

#38 Re: mORMot Framework » Today i decided to upgrade to last build, now my code is not working » 2020-06-12 11:47:07

I've checked your hint, but it's PayPal only. I need a real IBAN/SWIFT...

#40 mORMot Framework » Latest 9226 doesn't compile under Win » 2020-05-16 10:12:36

Replies: 1

[dcc32 Fehler] SynCrtSock.pas(3694): E2003 Undeklarierter Bezeichner: 'PUTF8Char'

#41 Re: mORMot Framework » Fast MM5 » 2020-05-09 20:12:33

Btw I used fpc 3.3.1 without issues

#42 Re: mORMot Framework » Fast MM5 » 2020-05-09 11:21:23

I can confirm fpcx64mm is faster than cmem (in my test scenario) and stable.

#44 Re: mORMot Framework » fpc memorymanager > cmem seems to be faster » 2020-03-31 16:00:02

I would test FastMM4 and give you feedback. Compilation works, but after starting comes:

Runtime error 216 at $000000000042E335
  $000000000042E335  GETCPUID
  $0000000000438109  RUNINITIALIZATIONCODE,  line 17342 of ../../mORMot/trunk/RTL7/FastMM4.pas
  $0000000000438135  FASTMM4_$$_init$,  line 17362 of ../../mORMot/trunk/RTL7/FastMM4.pas

#46 Re: mORMot Framework » fpc memorymanager > cmem seems to be faster » 2020-03-29 12:18:29

After starting with FastMM4:

Runtime error 216 at $0000000000428845

#47 Re: mORMot Framework » fpc memorymanager > cmem seems to be faster » 2020-03-29 11:17:18

Thanks for your information and results. I will try your FastMM4 and give you feedback.

Just a few remarks to your statements:

In my use cases there is more than enough server memory. The cpu cores are rather scarce. Therefore I consider the client CPU's like a shared system. The server delivers the data without special preparation, the clients prepare the delivered data as needed (sorting, aggregating ...).

In statistical pov the user gets only one time all needed data of the period of analysis and all the other work is done at client side (js). This gives the user a impression of faster responds, because data will only prepared at client side without request.

The second use case of getting large data from DB is for exporting data into second DB's (as you suggested) e.g. MS PowerBI.

#48 mORMot Framework » fpc memorymanager > cmem seems to be faster » 2020-03-29 10:01:57

Replies: 6

I've looked for FastMM and fpc an comes to using UBLOCKS and cmem.

Compiling with USEBLOCKS had no effect, but using of cmem works  noticeable better (faster).

My requests get better responds but the most interesting result cames from a larger statistic call, where I get a huge response from MongoDB. Without cmem I got an timeout from the MongoDB call. With cmem it works as under Windows/Delphi 64bit.

#49 Re: mORMot Framework » AV at BatchSend with Zeos/FB » 2020-03-29 09:22:36

The code where the error comes from has a define {$ifdef ZEOS72UP}.

But you has updated to ZEOS 7.3.

#50 Re: mORMot Framework » mORMot - Windows (http.sys/FastMM4) vs Linux » 2020-03-28 22:21:44

emk wrote:

- speed differences: Windows has a very fast "http.sys" and "FastMM4" memory manager, Linux? (I know FPC has some slower MM)
- general speed differences;

I can't give you technical answers, but my project feels a little bit slower under Linux. But I haven't analyze why or what's the reason for it. (FastMM4 could be better in case of bigger data transform to RawUTF8, but it's only a guess).

Http.sys could be faster, but in real projects the bottleneck are always the DB (MongoDB in my case). MongoDB is very fast, but 10 msec are much more than a plain http request, so differences here can only measure in test cases.

emk wrote:

- websockets: the same question

I didn't use it. But under Win you can't benefit from http.sys here, so linux should be faster.

emk wrote:

- proxy: can be put directly on web or needs a proxy? (I'm asking for both OS-es. Any penalty?)

I've used apache from the beginning as a proxy for my Windows service. Now I need only one Linux machine. I used also only one Windows machine with apache and ldap under Windows. For smaller companies with smaller DB sizes it's near the same and possible in production.
But it's not a must.

emk wrote:

- any other difference worth mentioning.

Many years ago (at 2000) we turned away from microsoft to Linux and FreeBSD. On server side Linux/BSD was better, faster, much more stable and all for low costs. You are more independent.

I think this arguments still exists today.

Board footer

Powered by FluxBB