Bug 43216 - ACTIVITY_CHECK does not work correctly when Tomcat is restarted
Summary: ACTIVITY_CHECK does not work correctly when Tomcat is restarted
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 6.0.14
Hardware: All All
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-26 09:28 UTC by Takayuki Kaneko
Modified: 2007-08-28 06:34 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Takayuki Kaneko 2007-08-26 09:28:12 UTC
Hi,

I noticed that org.apache.catalina.session.StandardSession.ACTIVITY_CHECK does
not work correctly because the StandardSession#accessCount will be set as -1
when Tomcat is restarted and session is loaded from the SESSION.ser file.

StandardManager#doLoad() calls session.endAccess() and this method execute 2 things.
 * set isNew = false
 * decrement accessCount

I think isNew attribute is already set by session.readObjectData(ois) in
StandardManager#doLoad(),
and accessCount is already set as 0.

IMHO, it is not necessary calling session.endAccess() in the doLoad().

Here is a patch.

Index: /tc6.0.x/trunk/java/org/apache/catalina/session/StandardManager.java
===================================================================
--- /tc6.0.x/trunk/java/org/apache/catalina/session/StandardManager.java
(revision 569774)
+++ /tc6.0.x/trunk/java/org/apache/catalina/session/StandardManager.java
(working copy)
@@ -395,7 +395,6 @@
                     session.setManager(this);
                     sessions.put(session.getIdInternal(), session);
                     session.activate();
-                    session.endAccess();
                 }
             } catch (ClassNotFoundException e) {
               log.error(sm.getString("standardManager.loading.cnfe", e), e);
Comment 1 Peter Rossbach 2007-08-28 06:34:06 UTC
Please, check trunk I have checkin your fix. 
Thanks
Peter