You are not logged in.
Thanks!
I've tested your changes and it works in my project without issues.
Hello Arnaud,
this code doesn't work with a commit later than 96c8a5d3 (2022-02-12):
var
aCCGID: Integer;
V:= _OBJ([]);
aCCGID:= 1;
V.ID:= aCCGID;
Debugger shows a EJsonException instead of a parsed json.
(Windows11, Delphi 10.4, 32/64bit)
Daniel
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.
I've looked for tools for that too and under linux there are also xxd and vimdiff or colordiff.
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.
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...
1. Yes I'm using a reverse proxy (apache2) from the beginning of my career.
2.
Length of Res (Service-Result) = 123579733
Length of Ctxt.OutContent = 123579746 (this is +13 of 123579733 (because of +'{"result":[]}' what's correct))
3.
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
result := inherited Request(Ctxt);
in HttpServer.Request from a service call with standard RawJSON result (result:[JSON-Content from Service])
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
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?
Daniel
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?
Thank you!
TMongoConnection.Open were the right place, but constructor hasn't a param for it.
Where can I set IgnoreSSLCertificateErrors to true for MongoClient?
Did you call MapField('ID', 'YourExternalPrimaryKeyIDField')?
You also shouldn't drink alcohol. But sometimes it's worth doing it.
And you are also mixing mORMot and mORMot2?
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
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.
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.
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.
Contabo is top! I used there services since 2018 without issues.
Hi Arnaud,
I just want to say thank you for this great class. It helped me implementing a client for EPSON fiscal server!
Greetings,
Daniel
I've made another pull request for using all connections of a cluster.
I've made a pull request on GitHub #326 to read from Slaves:
MongoDB.Client.Connections[0].RunCommand('DatabaseName', Command, Res, [mqfSlaveOk]);
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.
All right!
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).
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?
@Ab
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.
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?
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?
With current mORMot I get an Exception in 5455 SynMongoDB (Header fields are all 0).
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.
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?
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?
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)
mongodb://xxxx-shard-00-00.yahvx.mongodb.net:27017,xxxx-shard-00-01.yahvx.mongodb.net:27017,xxxx-shard-00-02.yahvx.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=atlas-midqwv-shard-0&ssl=true
connectionstring should be:
"mongodb+srv://username:<password>@clustername.yahvx.mongodb.net/<dbname>?retryWrites=true&w=majority"
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.
Thx,
Daniel
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...
I've checked your hint, but it's PayPal only. I need a real IBAN/SWIFT...
Wow, please send me your account number to make a donation
[dcc32 Fehler] SynCrtSock.pas(3694): E2003 Undeklarierter Bezeichner: 'PUTF8Char'
Btw I used fpc 3.3.1 without issues
I can confirm fpcx64mm is faster than cmem (in my test scenario) and stable.
with Zeos 7.3 it compiles normally
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
$0000000000418FA9
$000000000042496C
After starting with FastMM4:
Runtime error 216 at $0000000000428845
$0000000000428845
$000000000042484C
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.
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.
The code where the error comes from has a define {$ifdef ZEOS72UP}.
But you has updated to ZEOS 7.3.
- 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.
- 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.
- 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.
- 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.