Tomcat session replication issue

TL;DR - The node name in the sessionId is not being updated to the current node name in the backup when the primary goes down.

Tomcat version - apache-tomcat-7.0.50

I have two nodes (2 instances of my application in 2 seperate tomcats) set up, with the session replication config (also uses sticky session).Below is the cluster config from server.xml, which is inside the Engine tag. It is similar in both nodes, except the port numbers :

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="8">
    <Manager className="org.apache.catalina.ha.session.DeltaManager"
    expireSessionsOnShutdown="false"
    notifyListenersOnReplication="true"/>

    <Channel className="org.apache.catalina.tribes.group.GroupChannel">
        <Membership     className="org.apache.catalina.tribes.membership.McastService"
        address="228.0.0.4"
        port="45564"
        frequency="500"
        dropTime="3000"/>
        <Receiver      className="org.apache.catalina.tribes.transport.nio.NioReceiver"
        address="auto"
        port="4050"
        autoBind="100"
        selectorTimeout="5000"
        maxThreads="6"/>

        <Sender className="org.apache.catalina.tribes.transport.ReplicationTransmitter">
            <Transport     className="org.apache.catalina.tribes.transport.nio.PooledParallelSender"/>
        </Sender>
        <Interceptor className="org.apache.catalina.tribes.group.interceptors.TcpFailureDetector"/>
        <Interceptor      className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
    <Interceptor className="org.apache.catalina.tribes.group.interceptors.ThroughputInterceptor"/>\
</Channel>

<Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
filter=""/>
<Valve className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>

<Deployer className="org.apache.catalina.ha.deploy.FarmWarDeployer"
tempDir="/tmp/war-temp/"
deployDir="/tmp/war-deploy/"
watchDir="/tmp/war-listen/"
watchEnabled="false"/>
<ClusterListener className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
<ClusterListener className="org.apache.catalina.ha.session.ClusterSessionListener"/>
</Cluster>

From the tomcat Manager, I can see that session (Ex: D042A0C5E380EB9E500224C87233119C.myNode1) is being created in the primary node on login, and replicated in the backup correctly.

But, as soon as the primary node goes down, I am expecting the sessionId in the backup node to be updated with the current node name i.e : D042A0C5E380EB9E500224C87233119C.myNode2

Example :

When user logs in :

Node 1 - Primary - jsessionIdSample.node1 
Node 2 - Backup - jsessionIdSample.node1 

When one node 1 goes down (Expected) :

Node 1 - - jsessionIdSample.node1 (NODE GOES DOWN) 
Node 2 - Primary - jsessionIdSample.node2 

But what is happening :

Node 1 - - jsessionIdSample.node1 (NODE DOWN) 
Node 2 - Backup - jsessionIdSample.node1

I have two questions :

1) Is my understanding that the sessionID should be updated in the backup soon after the primary node goes down correct? I read the tomcat docs, and it seems it should.

2) If it should, can you please help me with the config to make this work?

I have tried solutions from other questions on SO, but none of them seem to work.

Thanks in advance!


1) Is my understanding that the sessionID should be updated in the backup soon after the primary node goes down correct? I read the tomcat docs, and it seems it should.

Answer: No, when the primary goes down, it goes down. there is no time for it to post anything to the backup node "I'm gonna crush". the Tomcat document said in here, it will replicate the session cross cluster of nodes. for the part that mentioned update, it mean to say, it will update across all nodes.(not the one already crushed).

2) If it should, can you please help me with the config to make this work?

Answer: N/A