#1 2023-10-24 12:18:47

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

AutoReconnect in NewStatementPrepared does not work as expected

Hi we have some Reconnect Problem (Backend is MySQL with UniDAC) by auth?/Username=

Let me Explain
We Connect a SOA Client with mormot Authentication.

For test Reason i build up a Query Cache by Calling 20 SOA - Calls from my SOA Client.
Then i disconnect/connect my MySQL Server (To Force a Connection lost)

After this the First SOA Call returns with Error 403 (unknown user)
(Here NewStatementPrepared finds the Statement: NewStatementPrepared(select ID,LogonName,DisplayName,PasswordHashHexa,GroupRights from DFSQLAuthUser where LogonName=? limit 1) in Cache and returns without Reconnect

The Next SOA Call works because NewStatementPrepared does a Reconnect.

What do you think ? Is there an Error in the Authentication because it does not reconnect ?

Here is a Screenshot from the Log: https://ufile.io/su7052wv


Rad Studio 12.1 Santorini

Offline

#2 2023-10-24 17:09:24

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

Re: AutoReconnect in NewStatementPrepared does not work as expected

From the logs, it seems indeed that the first SELECT fails with the cached statement, and the SOA call returns an error 403, whereas the 2nd  SELECT intercept the error and try to reconnect.

I tried to not use the cache if the database is marked as not "Connected":
https://github.com/synopse/mORMot2/commit/e647223c
But TUniConnection.Connected does not really check the wire, then it won't be enough.

I don't see any simple way, but disabling the statement cache by setting
   TSqlDBConnectionProperties.UseCache := false

Offline

#3 2023-10-24 18:15:48

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: AutoReconnect in NewStatementPrepared does not work as expected

Ty Arnaud, for me it works now. Using the Cache is not so Important than a successful reconnect - for Performance.
Our Trafic is very low.


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB