Author | Sessions |
Walter Matte
20.02.2008 02:46:19 |
I have a rtcHTTPServer on a form, on a datamodule I have a rtcDataServerLink and three rtcDataProviders. One of the rtcDataProviders OpenSession, with a KeepAlive for 3 minutes. I have a logout button on the form and if a user logs out I CloseSession. I have assigned a class to a Session.AsObject for each session I want to make sure this memory is release properly is the session does not close with logout. What I have seen is that if there are several dead sessions and I wait 5 or 10 minutes, these session are still there. It is not until another OpenSession is called that dead Sessions are freed, is that right? 1. When the user just closes the Browser how often and what triggers Session that are dead to be cleaned up?. (Closed) 2. If I shutdown the Server while sessions are still active I am getting an AV.... how can I wait or force sessions closed. Walter |
Danijel Tkalcec [RTC]
20.02.2008 10:50:32 |
Hi Walter, You should never assign your own objects directly to Sessions, but only store native data types to sessions (integers, strings, rtcRecords, rtcArrays, ...). To link your external objects to sessions, you will need to implement your own mecnahisms to find these objects by ID and store only the ID inside the session. 1. Session cleanup is done when a new Session is locked, which means that memory from each closed session will be released the next time some user needs to work with another sessions. In the current implementation, the last session data is being released with the Session pool in the finalize section of the "rtcDataSrv" unit. And at that time, all your objects should already be destroyed. 2. Can you debug the server to see where exactly you are getting the AV? Is it inside one of RTCs units (if yes, where?) or somewhere inside your code? PS. There is an internal function in the "rtcDataSrv.pas" unit called "DoneSessions" which is used to destroy the Session pool, but it will NOT trigger any session events and should NOT be called directly. Regards, |
Walter Matte
20.02.2008 13:16:55 |
Danijel, I will adjust my code and manage my objects in my own TObjectList and just keep a reference in the Session. This makes sense, and I was going to do this originally, but thought I could use the Session.AsObject, which worked fine except for the dead session not cleaning up my object. And I did decend the object from TrtcObject. It did the clean up when new Session is locked, but not when the server was shutdown. I‘m sure the AV is in my code, it only happens when all my objects are not destoyed. So managing them myself with a reference in Sessions will resolve it. This is my first application with RTC and I am enjoying RTC. Reliable, Flexible... I just need to learn the tool better. Thanks. Sincerely, |
Danijel Tkalcec [RTC]
20.02.2008 14:27:44 |
Hi Walter, I‘m glad you are enjoying RTC and hope you will find out and fix the problem with the AV at shutdown. Should you have any other questions or problems using the RTC SDK, let me know. Regards, |
Walter Matte
20.02.2008 15:53:36 |
Danijel, // GET /webtime // Create a Form, Keep Reference When user logs out FORM POST --------------------- Where can I put this when a Session is cleaned up because a User did not Logout but shut down the browse? Or do I have to iterate through the Session list to find out what MyFormList I have and there is no Session to clean up MyFormList. Where and how should I do this? Walter |
Danijel Tkalcec [RTC]
20.02.2008 16:02:30 |
Hi Walter, the "OnSessionClose" even will be fired when your session expires or when it is being cleaned up by the session garbage collector. If you have already clean up the session, there is nothing you should do there. To know if that is the case, you should use some session variable to remember your current state of the session, so you know about it and do not try to clean up your variables again. For example, in RTC Gateway, I use the boolean ‘login‘ session variable. Here is the "OnSessionClose" event from the RTC Gateway ... procedure TrdServerModule.ServerModuleSessionClose(Sender: TRtcConnection); To make sure the same code isn‘t executed twice, when I am manually closing the session and logging out the user on his request, I set the ‘login‘ variable to FALSE, so that the logout code isn‘t called twice. Regards, |
Walter Matte
20.02.2008 16:08:36 |
Danijel, Thank you again. Walter |
Sessions
时间: 2024-11-06 09:34:26
Sessions的相关文章
Django基础学习之Cookie 和 Sessions 应用
在Django里面,使用Cookie和Session看起来好像是一样的,使用的方式都是request.COOKIES[XXX]和request.session[XXX],其中XXX是您想要取得的东西的key,但是这两者的原理和实现方式确是非常的不同. 首先介绍Cookie,只要是HTTP协议,就会有COOKIE这个东西; 只要您的浏览器没有禁用Cookie,就 可是使用它.而且是不分用什么语言,用什么框架,因为这是在HTTP协议的层面支持的,浏览器会把您设置的XXX的这个Cookie在Respo
Load Balance Tomcat with Nginx and Store Sessions in Redis--reference
An awkward title, but that’s exactly what we’re going to do. For some time, I was looking for a way to push code to production systems with zero downtime and zero impact to any active users. Surprisingly, the solution took very little time to impleme
严重:IOException while loading persisted sessions:java.io.EOFException.
1.错误描述 java.io.EOFException 2.错误原因 由于项目在运行的过程中,异常地关闭了Tomcat,在项目文件下生成了SESSIONS.ser D:\MyEclipse\apache-tomcat-7.0.55\work\Catalina\localhost\SSH 3.解决办法 删除在该路径下的SESSIONS.ser文件,重新启动Tomcat,项目就会正常运行
【转】Tomcat出现SEVERE: IOException while loading persisted sessions: 
java.io.EOFException java.io.EOFException问题的解决方案
[java] view plaincopy 错误代码如下: 严重: IOException while loading persisted sessions: java.io.EOFException java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2325) at java.io.ObjectInputStream$BlockDataInputS
while loading persisted sessions [java.io.EOFException]的三种解决办法!
原因: (1)IOException while loading persisted sessions: java.io.EOFException当加载持久化的session错误:文件末尾异常,就是已经读取到文件末尾了,tomcat仍然试图读取内容. (2)修改jsp文件后,访问web页面时是修改前的效果,这是因为tomcat未及时编译jsp导致的所以要删除work目录下的catalinna的文件 解决方案: (1) 自己电脑的tomcat的版本比较高,可在自己的项目文件夹workspace -
PHP Sessions【1】
PHP Sessions PHP session 变量用于存储关于用户会话(session)的信息,或者更改用户会话(session)的设置.Session 变量存储单一用户的信息,并且对于应用程序中的所有页面都是可用的. PHP Session 变量 您在计算机上操作某个应用程序时,您打开它,做些更改,然后关闭它.这很像一次对话(Session).计算机知道您是谁.它清楚您在何时打开和关闭应用程序.然而,在因特网上问题出现了:由于 HTTP 地址无法保持状态,Web 服务器并不知道您是谁以及您
PHP Sessions
PHP Sessions PHP session 变量用于存储关于用户会话(session)的信息,或者更改用户会话(session)的设置.Session 变量存储单一用户的信息,并且对于应用程序中的所有页面都是可用的. PHP Session 变量 您在计算机上操作某个应用程序时,您打开它,做些更改,然后关闭它.这很像一次对话(Session).计算机知道您是谁.它清楚您在何时打开和关闭应用程序.然而,在因特网上问题出现了:由于 HTTP 地址无法保持状态,Web 服务器并不知道您是谁以及您
Exception loading sessions from persistent storage
严重: Exception loading sessions from persistent storage java.io.EOFException 删除Tomcat里面的work/Catalina/localhost下的内容即可解决 Tomcat在启动时出现如下异常问题: 严重: IOException while loading persisted sessions: java.io.EOFException 严重: Exception loading sessions from pers
[tmux] Handle history in tmux sessions
In this lesson, we'll look at how to manage your history between tmux sessions, and ensure that your setup preserves your bash history between multiple windows. By adding a special PROMPT_COMMAND to your .bashrc, you can update and reload your histor
转:严重: Exception loading sessions from persistent storage
启动项目时报以下异常 严重: Exception loading sessions from persistent storage java.io.EOFException 遇到上述异常,删除Tomcat里面的work\Catalina\localhost下的项目文件内容即可解决. 原因是由于项目测试中class文件或者其它文件更新过频繁. 之前经常碰到页面修改后,重新发布的项目页面还是原样,不管删掉tomcat/webapps/发布的项目还是重新部署,都无法显示修改后的效果, 但是其他页面修改