#1 2022-02-02 11:47:10

trx
Member
Registered: 2015-08-30
Posts: 30

[mORMot2] EAccessViolation in TServiceFactoryServer.InstanceFreeGC

Hi ab,

My server (Linux, FPC ) logs are getting filled with:

20220202 11342032 EXCOS EAccessViolation (0f) [Pool31adminauthpublicapi] at 737e00 ../mORMot2/src/soa/mormot.soa.server.pas tservicefactoryserver.instancefree (821) ../mORMot2/src/soa/mormot.soa.server.pas tservicefactoryserver.instancefreegc (842) ../mORMot2/src/soa/mormot.soa.server.pas tservicefactoryserver.retrieveinstance (1045) ../mORMot2/src/soa/mormot.soa.server.pas tservicefactoryserver.executemethod (1354) ../mORMot2/src/rest/mormot.rest.server.pas trestserveruricontext.internalexecutesoabyinterfacecomputeresult (3245) ../mORMot2/src/rest/mormot.rest.server.pas trestserveruricontext.internalexecutesoabyinterface (3298) ../mORMot2/src/rest/mormot.rest.server.pas trestserverroutingrest.executesoabyinterface (4455) ../mORMot2/src/rest/mormot.rest.server.pas trestserveruricontext.executecommand (2941) ../mORMot2/src/rest/mormot.rest.server.pas trestserver.uri (6880) ../mORMot2/src/rest/mormot.rest.http.server.pas tresthttpserver.request (1088) ../mORMot2/src/net/mormot.net.server.pas thttpservergeneric.request (1416) ../mORMot2/src/net/mormot.net.server.pas thttpserver.process (2008) ../mORMot2/src/net/mormot.net.server.pas thttpserversocket.taskprocessbody (2106) ../mORMot2/src/net/mormot.net.server.pas thttpserversocket.taskprocess (2062) ../mORMot2/src/net/mormot.net.server.pas tsynthreadpoolthttpserver.task (2474) ../mORMot2/src/core/mormot.core.threads.pas tsynthreadpoolworkthread.dotask (2834) ../mORMot2/src/core/mormot.core.threads.pas tsynthreadpoolworkthread.execute (2873)

I am on git commit fcc29c07aa0b3585a131bf6c30a2b4681927543b (reviewed all singleton locks), I am not sure when it started but it was also happening with commit f2fd54a8d92a4711acfc6802b25efad2282ffd17 (minor OpenSSL library refactoring)
After a while, the server becomes unusable.

Any idea what the culprit is?

Thanks!

Offline

#2 2022-02-02 13:48:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,220
Website

Re: [mORMot2] EAccessViolation in TServiceFactoryServer.InstanceFreeGC

I am not able to reproduce it here.

I guess there is something wrong with the way you work with interfaces.
Do you define interface callbacks?
They should not be released in your code.

How is your service defined?

Offline

#3 2022-02-02 14:05:20

trx
Member
Registered: 2015-08-30
Posts: 30

Re: [mORMot2] EAccessViolation in TServiceFactoryServer.InstanceFreeGC

I think it is happening when they expire, my interface services are used by an Angular app only.
It only starts happening after some time after the server is started.
See the following pastebin with the log:
https://pastebin.com/3jpjcpU0

I don't use any callbacks.
I register the services like so:
FMainRest.ServiceRegister(TOrderService, [TypeInfo(IOrderServiceCommand)], sicClientDriven).ResultAsJSONObject := True;

I haven't made any changes to the Angular app or the server in some time, I have only upgraded mORMot2.

Last edited by trx (2022-02-02 14:07:14)

Offline

#4 2022-02-02 15:21:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,220
Website

Re: [mORMot2] EAccessViolation in TServiceFactoryServer.InstanceFreeGC

You are right: the deprecated session instance was released, but not unregistered from the list.

Should be fixed now by https://github.com/synopse/mORMot2/commit/62329436

Sorry for the inconvenience.

Edit: from the logs, it appears that you are using the "old" HTTP server.
It creates one thread per client, when HTTP/1.1 is used, which is the case for your JavaScript client.
Consider using the new async HTTP server instead, which uses a thread poll for such connection.

Offline

#5 2022-02-02 16:44:59

trx
Member
Registered: 2015-08-30
Posts: 30

Re: [mORMot2] EAccessViolation in TServiceFactoryServer.InstanceFreeGC

I am following your work on that for some time, very nice!
I would like to use it, is it now the recommended server for production?

Thank you for your help and for fixing the issue so fast!

Offline

#6 2022-02-02 18:25:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,220
Website

Re: [mORMot2] EAccessViolation in TServiceFactoryServer.InstanceFreeGC

Yes, the async server seems stable now, with pretty good performance.
Our internal tests are very promising. I guess it is stable enough to be run on production.

But of course, some issue may occur, as with anything new: please report here if you encounter any problem.

Offline

Board footer

Powered by FluxBB