You are not logged in.
Pages: 1
Thank you
Hi Ab,
Thanks your for answer. My initial thought was that I should be taking extra steps to release the allocated resources.
I was aware that a Thread Pool was working on the inside. Is this Pool size customizable?
Regards,
Mane
hey, the memory numbers you see in the process tab of the task manager are just a crude approximation of actual memory used. If you have a lot of heap de/allocations like in your case then you are bound to have some heap fragmentation. This means the heap memory will grow over time (but should stabilize) which is what you are observing. There's not much wrong with that since the memory manager will try to reuse the fragmented space.
Absolutely the better way is to use a memory profiler instead of the task manager. If you have to use external software then the better choice is Microsoft's Process Explorer from SysInternals (You would look at the "Private Bytes" statistic of Virtual Memory), but again, it's all just crude approximation.
Thank you for the explanation Pvn0. I'm not really concern about the exact amount on memory used but the actual projected trend on allocation.
Regars, will take a look at the SysIternals.
regards,
Mane
Hello Folks,
I’ve a mORMot 1.18 server that right after it is started it uses around 8MB (Debug Release) of memory according to the “Processes” Tab on the Windows Task Manager. After a couple requests, it goes a up to 9.8 MB and then forward it keep growing without ever releasing.
All services are set to TServiceInstanceImplementation.sicSingle and no sessions are being created. It is all JWT authenticated on the NGINX side.
In each service method, a DataModule is created to access the backend database (No ORM here, yet). The creation and destroying of this resource in enclosed in a Try/Finally to make sure all allocated resources are released.
I did FastMM4 diagnostic on leaks, and after fixing some dumb errors at service startup, no more leaks are reported but memory consumption still is going up.
It is my understanding that with TServiceInstanceImplementation.sicSingle every resource allocated for a Request/Thread is free once the thread is finished…
Any idea or where should I be looking for or any tips on how to further diagnose this?
Regards,
Mario
ab wrote:You can use a local variable, I guess.
Or... split the string, it's just a compiler limit
TTextWriter.RegisterCustomJSONSerializerFromText( TypeInfo(TMyClass), 'field1, field2, ' + 'field3 RawUTF8' ).Options := [soReadIgnoreUnknownFields];
Yes, I've not though about that, thank you!
Regards,
Mane
Hello folks,
Today I hit a wall, and hope some of you guys know a workaround...
I'm registering a bunch of Custom JSON Serializer for a types I need to convert from JSON to TObject using the following statement...
TTextWriter.RegisterCustomJSONSerializerFromText(TypeInfo(TMyClass), 'field1, field2, field3 RawUTF8').Options := [soReadIgnoreUnknownFields];
However, I've exceed the 255 string literal limit of the Delphi compiler for a medium size packed record.
How do you register a Custom JSON Serializer for a type with over 50 fields?
Thanks in advance for you help.
Regards,
Mario
Sure, Ab. Thanks for taking it up for consideration.
Regards,
Mario
Hello folks,
It is possible to change the default authentication from GET ModelRoot/auth?UserName=... to work with a POST method?
Regards,
Mario
Thank you very much Xalo, I'll dive in.
Regards,
Mane
Hello folks,
I'm developing a SPA web application with mORMot in the backend base on TSQLRestServerFullMemory, an so far everything is going nicely.
However, I couldn't find a way to keep the session from expiring.. I've looked into TServiceFactoryServer.SetTimeoutSec but it seems like this is not way to do it.
What I would like to achieve is, once a user is properly authenticated, he can sent a request to server, regarles of the time of inactivity it mighty lapsed from the last request, and have it served. (Much like Gmail).
Is this possible?
Regards,
Mane
Thank you Ab!
Regards,
Mane
Hello Everybody,
I've implemented a custom authentication procedure through TSQLRestServer.OnAuthenticationUserRetrieve, and it is working fine.
The thing is that I would like to have some control on the message that gets sent to the users when the authentication fails for any reason. When the authentication fails the sever returns a StatusCode 403 and content with the message "Forbidden".
I would like to be able to change the message to "Invalid Username", "Wrong Password", "Account inactive", etc. I've looked at TSQLRestServer.OnAuthenticationFailed but it doesn't allow for changing the returned message.
It is necessary to subclass TSQLRestServer to change this behaviour or I'm missing something?
Regards,
Mane
Hi,
Thanks to the support from the forum and AB in particular, I finally managed to implement a successful RESTFul authentication handshake and the server gave me the ok.
Now, the second stage, attempting a Logout...
Apparently the server is unable to log out, because it has trouble retreiving the recently created session in order to close it.
The url used looks like this..
http://127.0.0.1:8080/root/auth?UserNam … n=088F34DF
The session parameter value is the returned SessionID from the previous successful logon. In the sample above the Hex version is used, but also tried with the regular int, with same result..
After some debugging at TSQLRestServerURIContext.Authenticate, I discover that the server couldn't retrieve the session. The line..
aSession := Server.fSessionAuthentication[i].RetrieveSession(self);
Returns aSession = nil,
And finally get a "Bad Request" message at the web browser client...
Any idea, of what am I possible missing?
Regards,
Mario
Thank you Ab, that did the trick... and way much cleaner that my intended approach.
Regards,
Mane
Hi folks,
Still getting aquinted with the Framework, and the documentation and this forums have proven very valuable.
I've hit an obstacle and I yet to find a workaround...
I using the mORMot framework to implement a REST web server (without the ORM part), so I choose TSQLRestServerFullMemory class as a starting point and is working fine so far.
I've reached a point where I want to implement authentication and would like to use then approach on TSQLRestServerAuthenticationDefault, but would like to control the database against where the user/password is checked.
After the first handshake is done and the client respond with the complete URI, I have added an additional parameter "AppCtx" that tells me which database should I be checking against.
Sample URI...
http://localhost:888/root/auth?UserName=User&PassWord=fa8ae08c4e3210e7cc9b13b5b2a7188cddb405cc1323f7003084f785fa35c549&ClientNonce=5E54D885B8664725990EE78CC976C1E5&AppCtx=DEV01
On the server side I though it would be a matter of just subclassing TSQLRestServerAuthenticationDefault.Auth but I discover the Ctxt.AuthenticationFailed was on protected scope and suddenly things got more complicated, since I would like to overriding as little as posible as to remain "future proof" on the new releases of the framework...
I'm not user if my approach is correct or if I'm missing something obvious...
Would be nice if someone could offer some advice...
Regards,
Mario
Pages: 1