设为首页 加入收藏

TOP

Sessions(一)
2017-10-10 12:03:43 】 浏览:6222
Tags:Sessions

 

Author Sessions
Walter Matte

20.02.2008 02:46:19
Registered user
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
Registered user
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,
Danijel
Walter Matte

20.02.2008 13:16:55
Registered user
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,
Walter
Danijel Tkalcec [RTC]

20.02.2008 14:27:44
Registered user
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,
Danijel
Walter Matte

20.02.2008 15:53:36
Registered user
Danijel,

//  GET  /webtime
  OpenSession;
  Session.KeepAlive:= 60 * 5;   // seconds  * minutes
  Response.Cookie['sid']:=Session
首页 上一页 1 2 3 下一页 尾页 1/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇Determing client's IP 下一篇TRtcHttpServer Connections.

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目