Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Cannot lock session manager...
Thu, Nov 25 2021 12:24 AMPermanent Link

Ian Branch

Avatar

Hi Team,
Not sure if this should be here or in Connectivity.
I have some code that executes before TEDBDatabase disconnects..
{code}
procedure TdmC.DBC1BeforeDisconnect(Sender: TObject);
begin
 //
 tqServerSessions.ExecSQL;
 nSessionCount := tqServerSessions.RecordCount;
 tqServerSessions.Close;
 //
{code}
tqServerSessions has the following SQL..
{sql}
SELECT * FROM Configuration.ServerSessions
WHERE (Pos('DBi', User) > 0) and (Connected = True)
Order by ID
{sql}

Occasionally the Users get an error message..
"ElevateDB Error #506 Cannot lock the session manager (ID: 20)."
with the error ostensibly occurring at the "tqServerSessions.ExecSQL;"

Is there some way to mitigate this so it tries again?
Is this related to one of the retry settings?
I need this action to complete for follow up action.

Regards & TIA,
Ian
Thu, Nov 25 2021 9:35 AMPermanent Link

Raul

Team Elevate Team Elevate

On 11/25/2021 12:24 AM, Ian Branch wrote:
>
> Occasionally the Users get an error message..
> "ElevateDB Error #506 Cannot lock the session manager (ID: 20)."
> with the error ostensibly occurring at the "tqServerSessions.ExecSQL;"
>
> Is there some way to mitigate this so it tries again?
> Is this related to one of the retry settings?
> I need this action to complete for follow up action.


Catch the exception and repeat - super simpler version though i would
suggest something bit more sophisticated in the real world

for i := 1 to 3 do
begin
  try
    tqServerSessions.ExecSQL;
    nSessionCount := tqServerSessions.RecordCount;
    tqServerSessions.Close;
    break;
  except
  begin
     Sleep(250); //sleep approx 1/4 sec between retries
  end;
end


Raul
Fri, Nov 26 2021 2:26 PMPermanent Link

Ian Branch

Avatar

I like simple... Wink
Image