bossadvisors / memcached-session-manager

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

Non-expiring, non-sticky sessions are always invalid when loaded from backup node #120

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup a 2 tomcat6/memcached node non-sticky configuration with tomcat 
sessions that do not expire
2. Log in to one of the tomcats
3. Restart the primary memcached node for the session just created

What is the expected output? What do you see instead?

Expected: The session should be retrieved from the backup memcached node and 
used.  The user should not be logged out.

Actual: The user is logged out.  The session is loaded from the backup node, 
but determined to be invalid because the idle time is greater than the 
maxInactiveInterval for the session, because the interval is set to a negative 
value.

What version of the product are you using? On what operating system?

Latest on master: a38fec9e5ddabd7cf9b4b33615b926decf5940ca

Ubuntu 10.04 LTS, tomcat 6.0.24

Please provide any additional information below.

I can send you a pull request on github shortly.

Original issue reported on code.google.com by markwhit...@gmail.com on 8 Feb 2012 at 4:47

GoogleCodeExporter commented 9 years ago
Can you please also post your configuration?

When submitting a pull request (what I'd highly appreciate) a test pointing out 
the issue would be cool!

Original comment by martin.grotzke on 8 Feb 2012 at 5:31

GoogleCodeExporter commented 9 years ago
Sorry, forgot the config.  Also, we are using version 1.6.1 of the plugin.

    <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
             memcachedNodes="n1:node1:11211,n2:node2:11211"
             sticky="false"
             lockingMode="auto"
             requestUriIgnorePattern="/rest/ignorable/?$"
             backupThreadCount="4"
             operationTimeout="100"
  transcoderFactoryClass="de.javakaffee.web.msm.JavaSerializationTranscoderFactory"/>

I put in the pull request, there is a simple unit test.  I can try to 
reconstruct an integration test, if that would be helpful.  Let me know, thanks.

Original comment by markwhit...@gmail.com on 8 Feb 2012 at 5:35

GoogleCodeExporter commented 9 years ago
An integration test would be great, but I can write this also after merging.

Original comment by martin.grotzke on 8 Feb 2012 at 6:38

GoogleCodeExporter commented 9 years ago
Regarding the configuration, your web.xml contains a session-timeout="-1"?

Original comment by martin.grotzke on 8 Feb 2012 at 8:58

GoogleCodeExporter commented 9 years ago
Honestly, I don't know where our expiry is setup for our webapp configuration 
right now.  It is not set in web.xml, so it is probably in some Spring config 
somewhere.

Session.getMaxInactiveInterval() is returning -60 (not sure why it is not -1 or 
0).  The tomcat6 javadocs say any negative value should count as non-expiring:

https://tomcat.apache.org/tomcat-6.0-doc/api/org/apache/catalina/Session.html#ge
tMaxInactiveInterval()

Original comment by markwhit...@gmail.com on 8 Feb 2012 at 9:47

GoogleCodeExporter commented 9 years ago
Ok, I'm just writing the integration test...

Original comment by martin.grotzke on 8 Feb 2012 at 9:48

GoogleCodeExporter commented 9 years ago
Ok, I'm just writing the integration test...

Original comment by martin.grotzke on 8 Feb 2012 at 9:51

GoogleCodeExporter commented 9 years ago
Thanx for the pull request!

It's merged into master, and I added the integration test 
(NonStickySessionsIntegrationTest.testLoadBackupSessionShouldWorkWithInfiniteSes
sionTimeoutIssue120).

Original comment by martin.grotzke on 8 Feb 2012 at 10:00

GoogleCodeExporter commented 9 years ago
Do you need an immediate release btw?

Original comment by martin.grotzke on 8 Feb 2012 at 10:44

GoogleCodeExporter commented 9 years ago
Nope, we are just using a patched version for now.  Just put it in your next 
scheduled release if you can.  Thanks a lot!

Original comment by markwhit...@gmail.com on 8 Feb 2012 at 11:00

GoogleCodeExporter commented 9 years ago
Ok.

Original comment by martin.grotzke on 9 Feb 2012 at 9:08