Administrators Farshad Mohajeri Posted October 3, 2020 Administrators Share Posted October 3, 2020 Hi, One of your sessions seems to remain alive for 1013 idle seconds which is 17 minutes. What is your SessionTimeout value? Quote Link to comment Share on other sites More sharing options...
aristeo Posted October 3, 2020 Share Posted October 3, 2020 15 minutes + 5 minutes. SessionTimeOut is 15 minutes, but when time is out, the server (with websocket) opens a window in the browser with a 5 minutes countdown for closing session with a button to cancel it Quote Link to comment Share on other sites More sharing options...
aristeo Posted October 3, 2020 Share Posted October 3, 2020 The OnSessionTimeOut has a code like this procedure TUniMainModule.UniGUIMainModuleSessionTimeout(ASession: TObject; var ExtendTimeOut: Integer); begin if /*Connected to WebSocket*/ then begin ExtendTimeOut:=UniServerModule.SessionTimeout; /*This instruction is to send a GET to a REST service, for the websocket server sends a #TIMEOUT# message to the browser to open a window with CountDown*/ /*TUniMainModule(TUniGUISession(ASession).UniMainModule).GUID stores the GUID of the websocket client in the browser of the user*/ EnviarMensajeServidor(TUniMainModule(TUniGUISession(ASession).UniMainModule).GUID,'#TIMEOUT#') end; end; Quote Link to comment Share on other sites More sharing options...
aristeo Posted October 3, 2020 Share Posted October 3, 2020 The websocket is created in the OnCreate of MainForm. With a code like this UniSession.AddJS(ReadString(Size) + #13 + 'socket=new sgcWebSocket(''ws' + Copy(UniServerModule.ServidorWebSocket, 5, Length(UniServerModule.ServidorWebSocket) - 4) + '/sgc/auth/session/' + Token + ''');' + #13 + 'socket.on(''open'', function(event) { ajaxRequest(' + Name +'.form,''Open'', []);});' + #13 + 'socket.on(''close'', function(event) { ajaxRequest(' + Name +'.form,''Closed'', [event.message]); });' + #13 + 'socket.on(''error'', function(event) { ajaxRequest(' + Name +'.form,''Error'', [event.message]); });' + #13 + 'socket.on(''message'', function(event) { ajaxRequest(' + Name +'.form,''Message'', [event.message]); });'); when the websocket client receives a message send an ajaxRequest to the MainForm with the Message "Message". So simply, i capture the message on the OnAjaxEvent of MainForm. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 3, 2020 Administrators Share Posted October 3, 2020 24 minutes ago, aristeo said: The OnSessionTimeOut has a code like this procedure TUniMainModule.UniGUIMainModuleSessionTimeout(ASession: TObject; var ExtendTimeOut: Integer); begin if /*Connected to WebSocket*/ then begin ExtendTimeOut:=UniServerModule.SessionTimeout; /*This instruction is to send a GET to a REST service, for the websocket server sends a #TIMEOUT# message to the browser to open a window with CountDown*/ /*TUniMainModule(TUniGUISession(ASession).UniMainModule).GUID stores the GUID of the websocket client in the browser of the user*/ EnviarMensajeServidor(TUniMainModule(TUniGUISession(ASession).UniMainModule).GUID,'#TIMEOUT#') end; end; ExtendTimeOut:=UniServerModule.SessionTimeout; Each time you call above line, your session will be extended for another 15 minutes. It is quite possible that above code is the reason that your sessions are kept alive. Quote Link to comment Share on other sites More sharing options...
aristeo Posted October 3, 2020 Share Posted October 3, 2020 yes... but i think that i need extend timeout to show the countdown window. When the 5 minutes windows countdown arrives 0, the session is terminated. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 3, 2020 Administrators Share Posted October 3, 2020 But your timeout extension code may go into an infinite cycle which may keep sessions indefinitely alive. You need to make sure such a condition will never occur. BTW, we already have a built-in mechanism to show a timeout window. Have you reviewed our Session Idle Timeout demo project? Quote Link to comment Share on other sites More sharing options...
aristeo Posted October 3, 2020 Share Posted October 3, 2020 Ok.... I haven't saw that sample. I will implement this, like Session Idle TimeOut and I will inform about the resul. Thanks. 1 Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 3, 2020 Administrators Share Posted October 3, 2020 9 minutes ago, aristeo said: Ok.... I haven't saw that sample. I will implement this, like Session Idle TimeOut and I will inform about the resul. Thanks. OK. My recommendation is to avoid using "ExtendTimeOut" to extend session timeout. Quote Link to comment Share on other sites More sharing options...
aristeo Posted October 4, 2020 Share Posted October 4, 2020 ok... thanks Farshad... ExtendTimeOut was de problem. It makes that randomly the sessions stay blocked. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 8, 2020 Administrators Share Posted October 8, 2020 On 10/4/2020 at 2:21 PM, aristeo said: ok... thanks Farshad... ExtendTimeOut was de problem. It makes that randomly the sessions stay blocked. Good to see your problem is resolved. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted October 20, 2020 Share Posted October 20, 2020 On 08/10/2020 at 06:16, Farshad Mohajeri said: É bom ver que seu problema foi resolvido. Good Morning, I still have the problem of blocking sessions in my unigui, I am using version 1537 as seen in image 2. See in image 1 that I selected an executable and it is not using the 0% CPU, I clicked with the right mouse button to find out which folder it was part of, after that in image 2 we can see that there are sessions stuck to more than 10 hours. I was able to find out that in case an error occurs in the system and the unigui does not manage to show this error and hangs the session, it gets stuck. I was generating a report and it gave some error that it did not show in my error handling, I closed the browser roughly and opened a new system tab, I did it last night for 2 times, after that I stayed with this session Node id = 0 and 1 prey. See that I open the list of sessions and it is empty. The problem is that the memory consumption of my server is very high and the firebird process is never closed, it is always increasing, see in image 2 how the firebird has high memory consumption. In image 5 we can see how the machine is working. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 20, 2020 Administrators Share Posted October 20, 2020 The attached image above are too small. It is hard to see the details. Have you tried setting "recycle_after_idle_seconds" parameter of HyperServer? Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted October 20, 2020 Share Posted October 20, 2020 24 minutes ago, Farshad Mohajeri said: A imagem anexada acima é muito pequena. É difícil ver os detalhes. Você já tentou definir o parâmetro "recycle_after_idle_seconds" do HyperServer? I'm sorry, I didn't notice that the image is distorted when you enlarge it, Where do I set this recycle_after_idle_seconds parameter? Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 20, 2020 Administrators Share Posted October 20, 2020 3 minutes ago, eduardosuruagy said: I'm sorry, I didn't notice that the image is distorted when you enlarge it, Where do I set this recycle_after_idle_seconds parameter? In CFG file of your hyperserver. Please see docs: http://www.unigui.com/doc/online_help/installing-and-configuring-hyp.htm Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted October 20, 2020 Share Posted October 20, 2020 4 minutes ago, Farshad Mohajeri said: No arquivo CFG do seu hiperservidor. Por favor, veja os documentos: http://www.unigui.com/doc/online_help/installing-and-configuring-hyp.htm Am I using the standard, is it correct or can I improve in some way? [node_recycling] enabled=1 recycle_after_secs=3600 recycle_after_sessions=0 recycle_after_idle_secs=300 recycle_when_empty=1 recycle_after_idle_seconds=0 Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 20, 2020 Administrators Share Posted October 20, 2020 1 minute ago, eduardosuruagy said: Am I using the standard, is it correct or can I improve in some way? [node_recycling] enabled=1 recycle_after_secs=3600 recycle_after_sessions=0 recycle_after_idle_secs=300 recycle_when_empty=1 recycle_after_idle_seconds=0 recycle_after_idle_secs=300 You can remove above line. It is no longer used. recycle_after_idle_seconds=0 For above line set it to max amount that a session is allowed to remain idle. For example 15 minutes (15x60=900 secs)? It depends on your application design. What is the max amount of time where a Node may stay idle? Set it to that amount and HyperServer will destroy that Node if it remains idle more than that period. Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted October 20, 2020 Share Posted October 20, 2020 3 hours ago, Farshad Mohajeri said: 3 hours ago, Farshad Mohajeri said: recycle_after_idle_secs = 300 Você pode remover a linha acima. Não é mais usado. recycle_after_idle_seconds = 0 Para a linha acima, defina-o para o valor máximo permitido para uma sessão permanecer inativa. Por exemplo, 15 minutos (15x60 = 900 segundos)? Depende do design do seu aplicativo. Qual é a quantidade máxima de tempo em que um nó pode ficar ocioso? Defina-o com esse valor e o HyperServer destruirá esse nó se permanecer inativo por mais do que esse período. = 300 Você pode remover a linha acima. Não é mais usado. recycle_after_idle_seconds = 0 Para a linha acima, defina-o para o valor máximo permitido para uma sessão permanecer inativa. Por exemplo, 15 minutos (15x60 = 900 segundos)? Depende do design do seu aplicativo. Qual é a quantidade máxima de tempo em que um nó pode ficar ocioso? Defina-o com esse valor e o HyperServer destruirá esse nó se permanecer inativo por mais do que esse período. I will use the recycle_after_idle_seconds = 900 option because my session limit is 10 minutes. Is it okay if I leave this option recycle_after_idle_secs ?? I have to remove from several files there if it is not a problem for me it would be better. Quote Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted October 20, 2020 Administrators Share Posted October 20, 2020 1 minute ago, eduardosuruagy said: Is it okay if I leave this option recycle_after_idle_secs ?? Yes Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted October 20, 2020 Share Posted October 20, 2020 16 minutes ago, Farshad Mohajeri said: sim Once again I thank you very much for your help, thank you very much !! 1 Quote Link to comment Share on other sites More sharing options...
RobertoLopes Posted October 20, 2020 Author Share Posted October 20, 2020 13 minutes ago, eduardosuruagy said: Once again I thank you very much for your help, thank you very much !! BY the way. Everytime you change the parameter do not forget to recycle the IIS app pool or restart your service (in case you use Hyperserver as a windows service). Quote Link to comment Share on other sites More sharing options...
eduardosuruagy Posted October 20, 2020 Share Posted October 20, 2020 1 hour ago, RobertoLopes said: A propósito. Toda vez que você alterar o parâmetro, não se esqueça de reciclar o pool de aplicativos do IIS ou reiniciar seu serviço (no caso de usar o Hyperserver como um serviço do Windows). Ok, Obrigado pela dica!! 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.