Bug 50448 - StandardSession.expire causes IllegalStateException: getCreationTime: Session already invalidated
Summary: StandardSession.expire causes IllegalStateException: getCreationTime: Session...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: trunk
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-09 19:23 UTC by Martin Grotzke
Modified: 2010-12-11 08:13 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Grotzke 2010-12-09 19:23:29 UTC
Hi,

when verifying the fix for #50360 I ran into an issue with expired sessions during processExpires:

Dec 10, 2010 12:59:32 AM org.apache.catalina.core.ContainerBase backgroundProcess
WARNING: Exception processing manager de.javakaffee.web.msm.MemcachedBackupSessionManager[/] background process
java.lang.IllegalStateException: getCreationTime: Session already invalidated
	at org.apache.catalina.session.StandardSession.getCreationTime(StandardSession.java:1096)
	at org.apache.catalina.session.ManagerBase.remove(ManagerBase.java:802)
	at org.apache.catalina.session.StandardSession.expire(StandardSession.java:840)
	at org.apache.catalina.session.StandardSession.isValid(StandardSession.java:655)
	at org.apache.catalina.session.ManagerBase.processExpires(ManagerBase.java:609)
	at org.apache.catalina.session.ManagerBase.backgroundProcess(ManagerBase.java:594)
	at de.javakaffee.web.msm.MemcachedBackupSessionManager.backgroundProcess(MemcachedBackupSessionManager.java:1130)
	at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1214)

AFAICS in MemcachedBackupSessionManager I could override remove(Session session, boolean update) with calling super.remove(session, false) for invalid sessions.

Another option would be to change StandardSession.expire(StandardSession.java:840) so that it does not invoke manager.remove(this, true) but manager.remove(this, false).

Or even better: change ManagerBase.remove(ManagerBase.java:802) to invoke some session.getCreationTimeInternal() which skips validation.

What do you think?

Cheers,
Martin
Comment 1 Mark Thomas 2010-12-10 08:54:50 UTC
Thanks for the report. Fixed in 7.0.x and will be included in 7.0.6 onwards.
Comment 2 Martin Grotzke 2010-12-11 08:13:04 UTC
Thanx for the fix, now all tests for memcached-session-manager are green! Happy now, looking forward to tomcat 7.0.6. Keep on the great work!