emmerichLuang / memcached-session-manager

Automatically exported from code.google.com/p/memcached-session-manager
0 stars 0 forks source link

Redundant retrieval of session from memcached after TC failover (with jvmRoute + securityConstraint/Valve) #93

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Observed for the TC 7 branch, but likely not restricted to that.

Directly after Tomcat failover the session is retrieved twice from memcached. 
This is due to an internal Tomcat valve already accessing the session before 
your own SessionTrackerValve runs.

Please ignore line numbers in the below given stacks. I added lots of debug 
statements, so lines were shifted.

First time (example):

        at de.javakaffee.web.msm.MemcachedBackupSessionManager.loadFromMemcached(MemcachedBackupSessionManager.java:917)
        at de.javakaffee.web.msm.MemcachedBackupSessionManager.findSession(MemcachedBackupSessionManager.java:535)
        at org.apache.catalina.connector.Request.doGetSession(Request.java:2686)
        at org.apache.catalina.connector.Request.getSessionInternal(Request.java:2411)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:452)
...
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:394)

Second time (same request):

        at de.javakaffee.web.msm.MemcachedBackupSessionManager.loadFromMemcached(MemcachedBackupSessionManager.java:917)
        at de.javakaffee.web.msm.MemcachedBackupSessionManager.loadFromMemcachedWithCheck(MemcachedBackupSessionManager.java:892)
        at de.javakaffee.web.msm.MemcachedBackupSessionManager.changeSessionIdOnTomcatFailover(MemcachedBackupSessionManager.java:646)
        at de.javakaffee.web.msm.SessionTrackerValve.changeRequestedSessionId(SessionTrackerValve.java:200)
        at de.javakaffee.web.msm.SessionTrackerValve.invoke(SessionTrackerValve.java:128)

Since this could also happen with other Valves, it might make sense to check, 
wheher the session has already been retrieved to reduce dublicate work (and 
latency).

I didn't yet work on a patch :(

Original issue reported on code.google.com by rainer.j...@kippdata.de on 23 Mar 2011 at 2:05

GoogleCodeExporter commented 9 years ago

Original comment by martin.grotzke on 23 Mar 2011 at 8:09

GoogleCodeExporter commented 9 years ago
Fixed together with issue 92 in master and tomcat7 branch.

Original comment by martin.grotzke on 25 Mar 2011 at 11:25

GoogleCodeExporter commented 9 years ago
Yes, problem fixed. Works here too :)

Original comment by rainer.j...@kippdata.de on 31 Mar 2011 at 4:08