You are not logged in.
Pages: 1
I'm testing on converting one of my mORMot 1.18 project to mORMot 2.3.
I was able to get everything to compile after updating uses and a couple data types and method call changes. When I went to run my server application, I thought it was getting into an infinite loop or something, but then I started stepping through the code and I ended up in the ComputeRoutes procedure.
I then just let it run to see what would happen. It took this procedure 13 to 15 minutes to run, on each start up. Once it finished, everything worked as expected.
Looking in this procedure, I see it iterates through a couple for loops. In the upper section were it's working on the for loop for "0 to fModel.TablesMax", it then does another for loop on "0 to high(fPublishedMethods)". It was in this nested for loop that was causing my issue. I commented out this for loop and my server starts up instantly, and everything I use works.
Some information, my Models file has 74 tables in it, and I have 190+ published methods. So, looking at that code, I can somewhat understand why it would take 15 minutes and cause a memory footprint of almost 200MB when running.
I know it's not ideal to comment out that for loop, so I'm posting to see if anyone else had encountered a similar issue and had a better solution.
For reference, the for loop I'm referring to is in \src\rest\mormot.rest.server.pas, Lines 6924-6937 in the release version 2.3
Offline
Oh yes, you are right, it is a O(n*m) loop.
It actually prepares the router to call all published methods for all tables... in the fastest execution time possible.
So it add 14060 nodes for each HTTP method, which are [mGET, mPOST, mPUT, mDELETE] by default. That is, 56240 nodes in your case.
But taking 15 minutes and 200MB, it did not expect it...
I will look into it.
Just out of curiosity: do you use any of the methods against the table? Or are they just published REST methods with no link to tables?
Can you create an issue about it in https://github.com/synopse/mORMot2 ?
I perhaps don't have time to fix it now because I am at https://pascalconference.com/
Offline
Thank you for your quick reply!
All of mine are just published REST methods. I don't have any methods against the tables.
Regards,
Nick
Offline
Can you create an issue about it in https://github.com/synopse/mORMot2 ?
I perhaps don't have time to fix it now because I am at https://pascalconference.com/
Offline
Sure, I'll create a new issue there for this.
I'll copy our messages from here to it.
Regards,
Nick
Offline
Please try with
https://github.com/synopse/mORMot2/comm … e9fdf43019
If the fix is confirmed, you can close your issue:
https://github.com/synopse/mORMot2/issues/382
Offline
I pulled down the repository and tried it.
My software starts up fast as expected. All functions seem to work as expected.
Thank You!
I closed the issue.
One thing I noticed. It doesn't seem to give me any issues, but wanted to bring it up. Before the latest version, if you were to pull the URI host:port/root/tablename/ it would give a listing of the table IDs, but now it just says 400 Invalid URI. Maybe it's not a problem for anyone, I just wanted to bring it up as noticing it.
Offline
One thing I noticed. It doesn't seem to give me any issues, but wanted to bring it up. Before the latest version, if you were to pull the URI host:port/root/tablename/ it would give a listing of the table IDs, but now it just says 400 Invalid URI. Maybe it's not a problem for anyone, I just wanted to bring it up as noticing it.
I realized that, too. Although one can circumvent this issue, in the case this was being used only to check the server, that response, indeed, has changed.
Last edited by Prometeus (2025-09-30 13:08:34)
Offline
Please try with
https://github.com/synopse/mORMot2/commit/d8ae8d964
Now /root/tablename returns all IDs of this table, e.g. as [{"ID":1},{"ID":2}]
But /root/tablename/ returns 400 BAD_REQUEST as "Invalid URI".
Offline
Thank You. It works as described.
Offline
Pages: 1