Bug 51614 - PersistentManager loads session from Store and calls session.expire() twice.
Summary: PersistentManager loads session from Store and calls session.expire() twice.
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2011-08-04 11:19 UTC by Keiichi Fujino
Modified: 2011-08-04 11:48 UTC (History)
0 users

patch against trunk. (1.26 KB, text/plain)
2011-08-04 11:22 UTC, Keiichi Fujino

Note You need to log in before you can comment on or make changes to this bug.
Description Keiichi Fujino 2011-08-04 11:19:47 UTC
To check whether session is loaded into  memory, StoreBase#processExpires calls findSession(id). 

if (manager.findSession(keys[i]) != null) {
    isLoaded = true;

However, PersistentManager#findSession(id) loads session from Store when there is no session in memory. 
Because session loaded from Store is an invalid session
PersistentManager logs errorlog, calls session.expire(), and deletes session from Store. 

As a result, findSession(id) returns null, and isLoaded becomes false. 
And, session.expire() is called again, and the session is deleted from Store.

If manager is PersistentManager, it is necessary to call PersistentManagerBase#isLoaded(id). 
However, to avoid regression of r1033024, other managers call findSession(id).

Best regards.
Comment 1 Keiichi Fujino 2011-08-04 11:22:08 UTC
Created attachment 27348 [details]
patch against trunk.
Comment 2 Keiichi Fujino 2011-08-04 11:48:47 UTC
Fixed in 7.0.x and will be included in 7.0.20 onwards.