issue [#588]: Context expires. ContextExpireDateTime is checked and updated too often

Project:iMo-2011B
Component:Code
Category:bug report
Priority:normal
Assigned:Jurjen
Status:closed
Description

Sessions should expire when the time between session:DeactivateSession and session:ActivateSession is more than X minutes.
Not when the time between ActivateSession and DeactivateSession is too much, that would be just bad performance. It turns out that imo is checking that too, currently.

So the only time you need to look at expirationtime is during ActivateSession, and the only time you need to reset it is during DeactivateSession.

Instead, the expiration is now checked and reset during every locateContextValue() in ContextDatabase.cls. That's a lot of times in an active session, while only the first check and the last reset are relevant. That causes several problems:
- waste of time
- lock on ContextSet record (for add-interval) has bugged us once or twice

and the most important one: not every context is a sessioncontext.
You can have context for ever kind of process, session is just one example. A statefree server cannot control if clients have abandoned the system without saying goodbye, so a timeout is a valid guard. But for other contexts it is not. So the expiration should be checked and reset by the Session class, which can still use the Context class to store and fetch that.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Jurjen's picture

#1

About those locks:
We are using a semi-asynchronous client (Adobe Flex) and a statefree appserver. It happens that the client does an appserver request before the previous request has ended. So there are 2 (or more) appserver agents running for the same session at the same time. Each time when a context value is searched, teh ContextSet record is locked. Soon both agents are in a deadlock.

ede's picture

#2

Assigned to:Anonymous» zoltan.hegyi

Duplicate of issue #578

#3

Assigned to:zoltan.hegyi» virgil
Jurjen's picture

#4

No I don't think its a duplicate of 578.

578 proposes a work-around for the lock. It helps, yes.
But it does not consider that timeout should only be checked at session:activate (and reset only at session:deactivate)

#5

Assigned to:virgil» zoltan.hegyi
Status:active» to test
Jurjen's picture

#6

why did you set the status to "to test", it was not fixed at all!

Session:ActivateSession still does not check if the session is valid or expired, the expiration is still checked during context:getvalue which gets in the way when contextmanager is used for contexts that are not sessioncontext.

Jurjen's picture

#7

Assigned to:zoltan.hegyi» virgil
Status:to test» active

back from "to test" to "active"

ede's picture

#8

Project:iMo-2011A» iMo-2011B
Assigned to:virgil» Andrei

#9

Virgil could not reproduce this issue and reassigned it back to Zoltan to have it tested by somebody else from the team. That was Virgil's intention and I agree one could have understood differently :-).
This is put back to active and we will investigate more.

#10

Assigned to:Andrei» Jurjen
Status:active» to test

Reset and check context is moved to SessionManager. This way, only once is checked/appserver call.

#11

Status:to test» fixed
siterobot's picture

#12

Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.