You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2009/12/07 11:09:18 UTC

DO NOT REPLY [Bug 48345] New: Session does time-out shorter than setting in web.xml when PersistentManager is used.

https://issues.apache.org/bugzilla/show_bug.cgi?id=48345

           Summary: Session does time-out shorter than setting in web.xml
                    when PersistentManager is used.
           Product: Tomcat 6
           Version: 6.0.20
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: fujino.keiichi@oss.ntt.co.jp


I am encountering the problem that Session does time-out shorter than setting
in web.xml.

This is a simple scenario where the problem occurs. 

I am using PersistentManager by the following configuration.
<Context>
  <Manager className="org.apache.catalina.session.PersistentManager"
           maxIdleSwap="120">
    <Store className="org.apache.catalina.session.FileStore"/>
  </Manager>
</Context>

I am setting the session-timeout at five minutes.
<session-config>
    <session-timeout>5</session-timeout>
</session-config>

[scenario]
1. Create Session.
2. 120 seconds pass. 
   Session does swapOut. 
3. In addition, 120 seconds pass. 
   Get Session.
   Session does swapIn and access time of session in the memory is updated. 
4. In addition, 90 seconds pass.
   Get Session.

Because the access time of the session has been updated in (3),
The session should be able to be acquired.
However, the session can not be acquired. 

This cause is StoreBase#processExpires invoked between (3) and (4).
StoreBase#processExpire deletes the session saved in Store.
StoreBase#processExpires is as follows.

=====StoreBase#processExpires=====
public void processExpires() {
...
    for (int i = 0; i < keys.length; i++) {
        try {
            StandardSession session = (StandardSession) load(keys[i]);
            if (session == null) {
                continue;
            }
            if (session.isValid()) {
                continue;
            }
              ...
            if ( ( (PersistentManagerBase) manager).isLoaded( keys[i] )) {
                // recycle old backup session
                session.recycle();
            } else {
                // expire swapped out session
                session.expire();
            }
            remove(session.getIdInternal());
        } catch (Exception e) {
            ...
        }
    }
}
======

The session saved in Store is loaded, and StandardSession#isValid() is
executed. 
StandardSession#expire(true) is invoked for the session that passes 
session time-out in "StandardSession#isValid()". 

StandardSession#expire(true) invokes Manager#remove(Session).
As a result, the session is deleted from the session map. 

In a word, session in memory is deleted by invalidating old session in Store. 
As a result, session does time-out shorter than setting in web.xml

I made a patch against trunk.

Best regards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48345] Session does time-out shorter than setting in web.xml when PersistentManager is used.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48345

Konstantin Kolinko <kn...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Konstantin Kolinko <kn...@gmail.com> 2010-03-06 17:49:24 UTC ---
The fix for this issue was applied to 6.0 and is in 6.0.23 onwards.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48345] Session does time-out shorter than setting in web.xml when PersistentManager is used.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48345

--- Comment #1 from Keiichi Fujino <fu...@oss.ntt.co.jp> 2009-12-07 02:12:06 UTC ---
Created an attachment (id=24674)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24674)
patch for trunk.

patch for trunk.


IMHO,
the following are necessary for backport to 6.0_trunk. 

Applies these revisions.
http://svn.apache.org/viewvc?view=revision&revision=711716
http://svn.apache.org/viewvc?view=revision&revision=711720

remove duplicated local variable timeNow.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48345] Session does time-out shorter than setting in web.xml when PersistentManager is used.

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48345

--- Comment #2 from Mark Thomas <ma...@apache.org> 2009-12-30 03:36:58 GMT ---
Thanks for the patch. I have committed it to trunk and proposed a variation for
6.0.x

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org