tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Santiago Cruz Lambert <jorge-santiago.c...@deimos-space.com>
Subject Session replication question
Date Thu, 23 Dec 2010 15:22:20 GMT
Hi!

I'm not an expert on Tomcat and we purchase a load balancer service with two
tomcat 6.0.29 instances in separate Ubuntu servers with JVM version
1.6.0_22-b04. This instances have been configured to replicate the session
as follow:

<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
channelSendOptions="6" channelStartOptions="3">
                  <Manager
className="org.apache.catalina.ha.session.DeltaManager"
expireSessionsOnShutdown="false" notifyListenersOnReplication="true"/>
                  <Channel
className="org.apache.catalina.tribes.group.GroupChannel">
                          <Receiver
className="org.apache.catalina.tribes.transport.nio.NioReceiver"
                                  address="auto"
                                  port="4001"
                                  autoBind="100"
                                  selectorTimeout="5000"
                                  maxThreads="10"/>
                          <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.StaticMembershipInterceptor">
                                  <Member
className="org.apache.catalina.tribes.membership.StaticMember"
                                          port="4000"
                                          securePort="-1"
                                          host="xxx.xxx.xxx.xxx"
                                          domain="tomcat-cluster"

 uniqueId="{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}"/>
                          </Interceptor>
                          <Interceptor
className="org.apache.catalina.tribes.group.interceptors.MessageDispatch15Interceptor"/>
                  </Channel>
                  <Valve
className="org.apache.catalina.ha.tcp.ReplicationValve"
filter=".*\.gif;.*\.js;.*\.jpg;.*\.png;.*\.htm;.*\.html;.*\.css;.*\.txt;"/>
                  <Valve
className="org.apache.catalina.ha.session.JvmRouteBinderValve"/>
                  <ClusterListener
className="org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener"/>
                  <ClusterListener
className="org.apache.catalina.ha.session.ClusterSessionListener"/>
          </Cluster>

The balancer has a "sticky session" feature that makes persistent
connections for 300s and its balancing algorithm is "least connections".

The problem is when trying to connect to load balancer with a device that
changes its IP each request, it looks like session is not replicated and in
some cases we can see the session id in the manager but with empty
attributes.

We have our application distributable, sessions are Serializable and we
tried to change as previously I read in this list, the channelSendOptions
from 8 (Asynchronous) to 6, and in this way we stopped the SEVERE messages
from catalina saying something like:

SEVERE: Manager [localhost#]: Unable to receive message through TCP channel
java.lang.IllegalStateException: setAttribute: Session already invalidated
        at
org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1326)
        at
org.apache.catalina.ha.session.DeltaSession.setAttribute(DeltaSession.java:594)
        at
org.apache.catalina.ha.session.DeltaRequest.execute(DeltaRequest.java:164)
        at
org.apache.catalina.ha.session.DeltaManager.handleSESSION_DELTA(DeltaManager.java:1487)
        at
org.apache.catalina.ha.session.DeltaManager.messageReceived(DeltaManager.java:1437)
        at
org.apache.catalina.ha.session.DeltaManager.messageDataReceived(DeltaManager.java:1171)
        at
org.apache.catalina.ha.session.ClusterSessionListener.messageReceived(ClusterSessionListener.java:92)
        at
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:901)
        at
org.apache.catalina.ha.tcp.SimpleTcpCluster.messageReceived(SimpleTcpCluster.java:882)
        at
org.apache.catalina.tribes.group.GroupChannel.messageReceived(GroupChannel.java:269)
        at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
        at
org.apache.catalina.tribes.group.interceptors.TcpFailureDetector.messageReceived(TcpFailureDetector.java:110)
        at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
        at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
        at
org.apache.catalina.tribes.group.ChannelInterceptorBase.messageReceived(ChannelInterceptorBase.java:79)
        at
org.apache.catalina.tribes.group.ChannelCoordinator.messageReceived(ChannelCoordinator.java:241)
        at
org.apache.catalina.tribes.transport.ReceiverBase.messageDataReceived(ReceiverBase.java:225)
        at
org.apache.catalina.tribes.transport.nio.NioReplicationTask.drainChannel(NioReplicationTask.java:188)
        at
org.apache.catalina.tribes.transport.nio.NioReplicationTask.run(NioReplicationTask.java:91)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:662)

But we have the same problem with sessions.

What's wrong?

Any help is appreciated.
Thank you
-- 
Jorge S. Cruz Lambert
Telecom & Mobility

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message