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 2002/07/08 15:01:32 UTC

DO NOT REPLY [Bug 5507] - Swapping sessions causes exceptions and it doesn't work with FileStore

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5507>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5507

Swapping sessions causes exceptions and it doesn't work with FileStore





------- Additional Comments From bob@jadn.com  2002-07-08 13:01 -------

Currently when backup's of sessions expire they take out the session in RAM
along with them.  This patch fixes this problem.

Some details...  There are 2 types of sessions in the Store.

   1. Backed up Sessions (copies of sessions currently in RAM)

   2. Swapped out Sessions (not in RAM)

When backed up sessions expire, they should go away quietly.  When
swapped out sessions go away, they should do so like ones in RAM. (events
fire, etc...)     Additionally, a backed up session expireing should not
effect a copy of that session currently in RAM (RAM holds a more recent
copy - when a RAM version is expired, its backup is always removed) So
sessions in the store, but not in RAM are swap outs.  Sessions in RAM
and in the store are backups.

This code "expires" swap outs, and "recycles" backups when they run out
of time.

Cheers,
-bob


Index: PersistentManagerBase.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/PersistentManagerBase.java,v
retrieving revision 1.8
diff -u -r1.8 PersistentManagerBase.java
--- PersistentManagerBase.java	9 Jun 2002 02:19:43 -0000	1.8
+++ PersistentManagerBase.java	8 Jul 2002 12:53:04 -0000
@@ -551,6 +551,26 @@
 
 
     /**
+     * Return true, if the session id is loaded in memory
+     * otherwise false is returned
+     *
+     * @param id The session id for the session to be searched for
+     *
+     * @exception IOException if an input/output error occurs while
+     *  processing this request
+     */
+    public boolean isLoaded( String id ){
+        try {
+            if ( super.findSession(id) != null )
+                return true;
+        } catch (IOException e) {
+            log("checking isLoaded for id, " + id + ", "+e.getMessage(), e);
+        }
+        return false;
+    }
+
+
+    /**
      * Return the active Session, associated with this Manager, with the
      * specified session id (if any); otherwise return <code>null</code>.
      * This method checks the persistence store if persistence is enabled,
Index: StoreBase.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/session/StoreBase.java,v
retrieving revision 1.5
diff -u -r1.5 StoreBase.java
--- StoreBase.java	9 Jun 2002 02:19:43 -0000	1.5
+++ StoreBase.java	8 Jul 2002 12:53:04 -0000
@@ -313,7 +313,13 @@
                 int timeIdle = // Truncate, do not round up
                     (int) ((timeNow - session.getLastAccessedTime()) / 1000L);
                 if (timeIdle >= maxInactiveInterval) {
-                    session.expire();
+                    if ( ( (PersistentManagerBase) manager).isLoaded( keys[i] )) {
+                        // recycle old backup session
+                        session.recycle();
+                    } else {
+                        // expire swapped out session
+                        session.expire();
+                    }
                     remove(session.getId());
                 }
             } catch (IOException e) {

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>