hari bhandari Posted September 29, 2022 Share Posted September 29, 2022 Hello Everyone, we are sending session info to the server every 10 seconds but the code below occasionally gives us AV's and sometimes even couldn't lock session.We are just sending the string returned by this function to the api and the api handles the rest. SessionManager.Sessions.ExportSessionsList.Text; has anyone faced this issue before? and any suggestions to fix this? We tried Locking sessions to, but the issue was even more freequent. Quote Link to comment Share on other sites More sharing options...
lfgarrido Posted October 12, 2022 Share Posted October 12, 2022 Hi, We still having this issue, we followed Session List demo and we tried with or without s.Lock; To detail, we're using a UniThreadTimer for each 10 seconds get all sessions from each Node in HyperServer mode to get all sessions info and handle active sessions for licensing purposes, but we're getting a lot of access violations reported in exceptions log when SessionManager.Sessions.ExportSessionsList.Text cannot take sessions info. Userstring is set to "could not lock session" when this error is raisen @Sherzod do you have any clue about that? We're concerned to put our licensing system in production and face some lag or system locks 1 Quote Link to comment Share on other sites More sharing options...
lfgarrido Posted October 17, 2022 Share Posted October 17, 2022 Staff, any clue about this? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 17, 2022 Share Posted October 17, 2022 Hello @lfgarrido Can you send the code you are using? Is your method based on our demos? 1 Quote Link to comment Share on other sites More sharing options...
lfgarrido Posted October 19, 2022 Share Posted October 19, 2022 We have a UniThreadTimer at ServerModule to get Sessions info from each HyperServer Node and send to our License API, to handle how many users are using the system, since we don't have a native way to get all sessions when in HyperServer mode. But sometimes we got exceptions with AcessViolations showing that couldn't lock the sessions and Userstring is set to "could not lock session" when this error is raisen We started from SessionList demo, and we tested in both ways, doing S.Lock or not, the error keeps there randomly. procedure TUniServerModule.SessionsTimerTimer(Sender: TObject); var SessionText: TStringList; s : TUniGUISessions; begin SessionText := TStringList.Create; s := SessionManager.Sessions; s.Lock; //we tried with lock and without lock, both ways cause the error randomly try try SessionText.Text := SessionManager.sessions.ExportSessionsList.Text; SendUniSessionsToLicenseAPI(SessionText.Text); //call a procedure to send Sessions info to our License API except on E: Exception do begin Logger.AddLog('LICENSE TIMER ERROR: ' + E.Message); end; end; finally SessionText.Free; s.Unlock; //we tried with lock and without lock, both ways cause the error randomly end; end; Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 20, 2022 Administrators Share Posted October 20, 2022 If you want to get a list of sessions you can use the principles used in our demo Session List. ExportSessionsList method is designed for a different purpose and gets lots of additional information which are not needed by you. Quote Link to comment Share on other sites More sharing options...
lfgarrido Posted October 20, 2022 Share Posted October 20, 2022 Thanks for the answer Mr. Farshad Actually we started our License API calls, following exactly the Session List demo, but we also got the AV errors and UserString is set as "Could not lock session" So we tried to use ExportSessionsList but both ways sometimes we get same AV error reported in Logs, and show in our License API By the way, yes we use more info about sessions, to get more control of our licenses, like Last event, Browser User Agent, IP, etc And since we cannot get sessions all info using HyperServer mode, it's a important feature for us, because it's the way that we will sell our system, by simultaneous active session licenses. So we create a License API and a Portal to handle Licenses and let our customers to check who's online But we're concerned about these errors, so again any tip or good practice would welcome, or at least please check if is some uniGUI error, because I saw some posts with same error but unanswered and seems unsolved We're growing, today I renewed my subscription and bought more 2 licenses of uniGUI, but we need assistance for this case, because we're concerned about these locks. @augusto.pellis Quote Link to comment Share on other sites More sharing options...
lfgarrido Posted November 4, 2022 Share Posted November 4, 2022 We're still having this issue, any clue why it happens? @Sherzod @Farshad Mohajeri Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted November 4, 2022 Share Posted November 4, 2022 I would call the function SendUniSessionsToLicenseAPI(SessionText.Text) AFTER the s.unlock. So the Sessionlist is only locked for a short time. Quote Link to comment Share on other sites More sharing options...
lfgarrido Posted November 8, 2022 Share Posted November 8, 2022 On 11/4/2022 at 6:10 AM, Oliver Morsch said: I would call the function SendUniSessionsToLicenseAPI(SessionText.Text) AFTER the s.unlock. So the Sessionlist is only locked for a short time. Thx for your suggestion Oliver, I posted an old version, currently our code is like this and we still having the issue "Could not lock sessions" sometimes Quote Link to comment Share on other sites More sharing options...
Oliver Morsch Posted November 9, 2022 Share Posted November 9, 2022 But there is no SessionManager.Sessions.Lock That is definitely needed. Quote Link to comment Share on other sites More sharing options...
lfgarrido Posted November 18, 2022 Share Posted November 18, 2022 Thx again for your contribution Oliver, but as I mentioned above we tried even with or without s.Lock like uniGUI demo, but in both cases we had same issue, sometimer we get "Could not lock sessions" set as UserString, so I think is something from inners of uniGUI to show that could not lock a session for some reason, and we still need to know how to fix it, to use our License API in production, we will launch our application next month and we cannot handle active sessions properly using HyperServer, unfortunatelly. Quote Link to comment Share on other sites More sharing options...
picyka Posted November 18, 2022 Share Posted November 18, 2022 5 hours ago, lfgarrido said: Obrigado novamente por sua contribuição Oliver, mas como mencionei acima, tentamos mesmo com ou sem s.Lock como a demonstração uniGUI, mas em ambos os casos tivemos o mesmo problema, às vezes obtemos "Não foi possível bloquear sessões" definido como UserString, então acho é algo interno do uniGUI para mostrar que não foi possível bloquear uma sessão por algum motivo, e ainda precisamos saber como consertar, para usar nossa API de licença em produção, lançaremos nosso aplicativo no próximo mês e não podemos lidar com sessões ativas usando corretamente o HyperServer, infelizmente. an ugly alternative would be to record the sessions in the database Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.