magro / memcached-session-manager

A tomcat session manager that backups sessions in memcached and pulls them from there if asked for unknown sessions
Apache License 2.0
758 stars 348 forks source link

Session data not copied to node after recovery. #300

Open JakubDziworski opened 8 years ago

JakubDziworski commented 8 years ago

I have a problem non-sticky session configuration:

 <Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
    memcachedNodes="n1:host1.yourdomain.com:11211,n2:host2.yourdomain.com:11211"
    sticky="false"
    sessionBackupAsync="false"
    lockingMode="auto"
    transcoderFactoryClass="de.javakaffee.web.msm.serializer.kryo.KryoTranscoderFactory"
    />

I tested the following scenario:

  1. n1 goes down
  2. there are changes to session being performed
  3. n1 recoveres
  4. n2 goes down
  5. Session does not have changes from point 2

Looks like n2 does not copy data to n1 after n1 is recovered. Is it a bug or am I missing something in configuration?

magro commented 8 years ago

As I understand the scenario then the webapp receives a request only at 2, but not between 3 and 4. In this case msm cannot do anything because session replication is passive, i.e. only performed per request. To have active session replication you'd need something like couchbase.