strugglejl / memcached-session-manager

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

Support context configured with cookies="false" #159

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. tomcat forbid cookies
/conf/context.xml:
<Context cookies="false">
   <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
             memcachedNodes="n1:192.168.1.55:11211,n2:192.168.1.56:11211"
             sticky="false"
             sessionBackupAsync="false"
             requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
   transcoderFactoryClass="de.javakaffee.web.msm.JavaSerializationTranscoderFactory"
            />
</Context>
2.start tomcat server,do Login request,
i put customer info in session,login success
but i do other action,like query customer info with 
"http://ip:port:/something;jsessionid=46A87DE63835612CAF557AF34013E18D-n2";
fail,note i'm not login.

why memcached do not save Session when tomcat forbid cookies?

3.logs:

2013-4-2 11:56:08 de.javakaffee.web.msm.SessionIdFormat createSessionId
良好: Creating new session id with orig id 'ping' and memcached id 'n1'.
2013-4-2 11:56:08 de.javakaffee.web.msm.NodeAvailabilityCache 
updateIsNodeAvailable
良好: CacheLoader returned node availability 'true' for node 'n1'.
2013-4-2 11:56:08 de.javakaffee.web.msm.SessionIdFormat createSessionId
良好: Creating new session id with orig id 'E6636323F89B006F4E86DEA12FC02653' 
and memcached id 'n1'.
2013-4-2 11:56:08 de.javakaffee.web.msm.MemcachedSessionService createSession
良好: Created new session with id E6636323F89B006F4E86DEA12FC02653-n1
2013-4-2 11:56:09 de.javakaffee.web.msm.MemcachedSessionService backupSession
良好: No session found in session map for E6636323F89B006F4E86DEA12FC02653-n1
2013-4-2 11:56:09 de.javakaffee.web.msm.LockingStrategy 
onBackupWithoutLoadedSession
警告: Found no validity info for session id 
E6636323F89B006F4E86DEA12FC02653-n1
2013-4-2 11:56:09 de.javakaffee.web.msm.RequestTrackingHostValve 
logDebugResponseCookie
良好: Request finished, with Set-Cookie header: 
JSESSIONID=E6636323F89B006F4E86DEA12FC02653-n1; Path=/; HttpOnly
2013-4-2 11:56:09 de.javakaffee.web.msm.RequestTrackingHostValve invoke
良好: <<<<<< Request finished: POST /ark/client/customer/login 
==================
2013-4-2 11:56:09 de.javakaffee.web.msm.MemcachedSessionService backupSession
良好: No session found in session map for E6636323F89B006F4E86DEA12FC02653-n1
2013-4-2 11:56:09 de.javakaffee.web.msm.LockingStrategy 
onBackupWithoutLoadedSession
警告: Found no validity info for session id 
E6636323F89B006F4E86DEA12FC02653-n1
2013-4-2 11:56:09 de.javakaffee.web.msm.RequestTrackingHostValve 
logDebugResponseCookie
良好: Request finished, with Set-Cookie header: 
JSESSIONID=E6636323F89B006F4E86DEA12FC02653-n1; Path=/; HttpOnly
2013-4-2 11:56:09 de.javakaffee.web.msm.RequestTrackingHostValve invoke
良好: <<<<<< Request finished: POST /ark/client/customer/login 
==================
2013-4-2 11:56:09 de.javakaffee.web.msm.MemcachedSessionService backupSession
良好: No session found in session map for E6636323F89B006F4E86DEA12FC02653-n1
2013-4-2 11:56:09 de.javakaffee.web.msm.LockingStrategy 
onBackupWithoutLoadedSession
警告: Found no validity info for session id 
E6636323F89B006F4E86DEA12FC02653-n1
2013-4-2 11:56:09 de.javakaffee.web.msm.RequestTrackingHostValve 
logDebugResponseCookie
良好: Request finished, with Set-Cookie header: 
JSESSIONID=E6636323F89B006F4E86DEA12FC02653-n1; Path=/; HttpOnly
2013-4-2 11:56:09 de.javakaffee.web.msm.RequestTrackingHostValve invoke

Original issue reported on code.google.com by lstczhan...@gmail.com on 2 Apr 2013 at 7:22

GoogleCodeExporter commented 8 years ago
Issue 161 has been merged into this issue.

Original comment by martin.grotzke on 14 Jun 2013 at 11:55

GoogleCodeExporter commented 8 years ago
For both sticky and non-sticky sessions a newly created session was not stored 
in memcached when the context was configured with cookies="false". This is now 
fixed.

Original comment by martin.grotzke on 15 Jun 2013 at 10:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi,

<Context cookies="false" >
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>
    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
     memcachedNodes="endpoint:11211"
     requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
   transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
     sessionBackupAsync="false"
     sessionBackupTimeout="100"
     sticky="false"
     copyCollectionsForSerialization="false"
     />
</Context>

when i tried login manually i am able to login but after logging in for each 
request i am getting 403 error. I have 1.6.5 jars configured.

Actually, i am doing duration test in the AWS with the tool jmeter. we are 
getting 403 after few minutes into the test, pl see the below setting we tried 
in the memcache:

<Context >
    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
     memcachedNodes="endpoint:11211"
     requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$"
     transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
     sessionBackupAsync="false"
     sessionBackupTimeout="100"
     sticky="true"
     copyCollectionsForSerialization="false"
     />
</Context>

Can you please let me know why we are getting 403 after a few minutes into the 
test. we have configured the 1.6.5 jars.

Original comment by gagan.jo...@snapwiz.com on 11 Dec 2013 at 1:37