5 Replies Latest reply on Oct 15, 2002 8:03 PM by integ

    Clustering Question

    integ Newbie

      Does the clustering in JBoss-3.0.3_tomcat_4.0.5 support Sticky sessions + HTTP Session replication + Session failover? Or are they mutually exclusive?

      In the JBoss Clustering (Rabbit Hole) Feature Matrix it says " When used in conjunction with loadbalancer that support sticky sessions mechanism, it allows for session state caching "
      Does this mean that while using sticky sessions, during failover, server2 will pick up the session state of server1 from the session cache?

      Please help me with this one as i have to make a decision whether to use sticky or non - sticky sessions. If i have a transparent failover with session replication with sticky sessions that would be ideal for me. (ie client sticks to server1 until server1 fails, then transparently continues his sticky session on server2).So far session failover with sticky sessions hasnt worked for me.

      Thanks

        • 1. Re: Clustering Question
          Sacha Labourey Master

          JBoss supports session failover.

          The load-balancing behaviour must be handled externally, either by a hardware LB or software LB (such as Apache).

          Next, concerning sticky-sessions, you should really use that mechanism to avoid inconsistent behaviour. BUT this behaviour must be handled at the load-balancer level, not JBoss level: so you must configure your LB to correctly handle sticky sessions. (see numerous posts on this topic in this forum).

          Cheers,


          sacha

          • 2. Re: Clustering Question
            integ Newbie

            Hi Sacha,
            The LB does handle the sticky sessions properly - on server1 i get session as sessionid.server1 and on server2 as sessionid.server2. (server 2 is on a different machine)So the sticky sessions are working.

            BUT, when i try to failover, i get the following error and a new session id (which means session didnt replicate):

            19:23:27,517 ERROR [LogInterceptor] EJBException, causedBy:
            java.lang.NullPointerException
            at java.io.ByteArrayInputStream.(Unknown Source)
            at org.jboss.ejb.plugins.CMPClusteredInMemoryPersistenceManager.loadEnti
            ty(CMPClusteredInMemoryPersistenceManager.java:352)
            at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistence
            Manager.java:410)
            at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntityS
            ynchronizationInterceptor.java:262)
            at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstance
            Interceptor.java:152)
            at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockIntercep
            tor.java:107)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
            at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
            at org.jboss.ejb.Container.invoke(Container.java:712)
            at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
            at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.jav
            a:102)
            at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.
            java:77)
            at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:189)
            at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
            at $Proxy15.remove(Unknown Source)
            at org.jboss.ha.httpsession.server.ClusteredHTTPSessionService.removeHtt
            pSession(ClusteredHTTPSessionService.java:153)
            at java.lang.reflect.Method.invoke(Native Method)
            at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
            nDispatcher.java:284)
            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
            at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
            at $Proxy232.removeHttpSession(Unknown Source)
            at org.jboss.web.catalina.session.ClusterManager.removeSession(ClusterMa
            nager.java:496)
            at org.jboss.web.catalina.session.ClusterManager.remove(ClusterManager.j
            ava:277)
            at org.jboss.web.catalina.session.ClusteredSession.setId(ClusteredSessio
            n.java:348)
            at org.jboss.web.catalina.session.ClusterManager.findSession(ClusterMana
            ger.java:209)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
            ava:173)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
            rValve.java:170)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
            ava:170)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
            468)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
            ve.java:174)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458
            )
            at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
            at java.lang.Thread.run(Unknown Source)
            19:23:27,597 ERROR [Engine] Ajp13Processor[8009][4] process: invoke
            java.lang.NullPointerException
            at org.jboss.web.catalina.session.ClusterManager.findSession(ClusterMana
            ger.java:220)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
            ava:173)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatche
            rValve.java:170)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
            ava:170)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
            468)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:564)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
            ve.java:174)
            at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline
            .java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
            a:472)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)

            at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458
            )
            at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
            at java.lang.Thread.run(Unknown Source)

            Iam using JBoss3.0.3_tomcat4.0.5.I noticed that in previous versions - Jboss3.0.1_tomcat4.0.4 - the error didnt happen but still i got a new session id anyways.
            Point to note : Without sticky sessions, everything works FINE! - sessions replicate, failover happens etc.

            When i stop server1, does the session get replicated immediately on server2? I have put jbossha-httpsession.sar in deploy directory, in web.xml, True , specified roundrobin as bean loadbalancing policy in jboss.xml etc. i can attach these files if needed.

            Any solutions / ideas?
            Thanks


            • 3. Re: Clustering Question
              integ Newbie

              Please, anybody has any help/solution/ideas on this??? as far as i can see iam not doing anything wrong in the configuration...

              • 4. Re: Clustering Question
                integ Newbie

                This is the log iam getting on tomcat2 (after i stop tomcat1 which had sticky session going on it)

                The tomcat2 log clearly shows the session id (NsLuDM0DMSL+MeuDgdt3Vg**.tomcat1) which used to exist on tomcat1 - meaning that session IS being replicated, but subsequently there is an error in CMPClusteredInMemoryPersistenceManager.

                And why is removeHttpSession being called ? What is the need to remove the replicated session???


                2002-10-14 14:40:21,642 DEBUG [org.jboss.web.catalina.EmbeddedCatalinaServiceSX] Looking for sessions that have expired
                2002-10-14 14:40:57,093 DEBUG [org.jboss.web.catalina.EmbeddedCatalinaServiceSX] Looking for session with id=NsLuDM0DMSL+MeuDgdt3Vg**.tomcat1
                2002-10-14 14:40:57,103 DEBUG [org.jboss.ha.httpsession.server.ClusteredHTTPSessionService] getHttpSession called for session: NsLuDM0DMSL+MeuDgdt3Vg**.tomcat1
                2002-10-14 14:40:58,014 DEBUG [org.jboss.ha.httpsession.server.ClusteredHTTPSessionService] removeHttpSession called for session: NsLuDM0DMSL+MeuDgdt3Vg**.tomcat1
                2002-10-14 14:40:58,024 DEBUG [org.javagroups.DefaultPartition] [Mon Oct 14 14:40:58 PDT 2002] [INFO] NAKACK.send(): sending msg #1
                2002-10-14 14:40:58,024 DEBUG [org.javagroups.DefaultPartition] [Mon Oct 14 14:40:58 PDT 2002] [INFO] STABLE.startStableTask(): stable task started; num_gossip_runs=3, max_gossip_runs=3
                2002-10-14 14:40:58,024 DEBUG [org.jboss.ha.httpsession.server.ClusteredHTTPSessionService] removeHttpSession called for session: NsLuDM0DMSL+MeuDgdt3Vg**.tomcat1
                2002-10-14 14:40:58,024 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException, causedBy:
                java.lang.NullPointerException
                at java.io.ByteArrayInputStream.(Unknown Source)
                at org.jboss.ejb.plugins.CMPClusteredInMemoryPersistenceManager.loadEntity(CMPClusteredInMemoryPersistenceManager.java:352)
                at org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:410)
                at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:262)
                at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:152)
                at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)
                at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:203)
                at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:493)
                at org.jboss.ejb.Container.invoke(Container.java:712)
                at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:98)
                at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:102)
                at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
                at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:189)
                at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
                at $Proxy15.remove(Unknown Source)
                at org.jboss.ha.httpsession.server.ClusteredHTTPSessionService.removeHttpSession(ClusteredHTTPSessionService.java:153)
                at java.lang.reflect.Method.invoke(Native Method)
                at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
                at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                at $Proxy232.removeHttpSession(Unknown Source)
                at org.jboss.web.catalina.session.ClusterManager.removeSession(ClusterManager.java:496)
                at org.jboss.web.catalina.session.ClusterManager.remove(ClusterManager.java:277)
                at org.jboss.web.catalina.session.ClusteredSession.setId(ClusteredSession.java:348)
                at org.jboss.web.catalina.session.ClusterManager.findSession(ClusterManager.java:209)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:173)
                at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
                at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
                at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
                at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
                at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
                at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
                at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458)
                at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551)
                at java.lang.Thread.run(Unknown Source)

                I'll take a look again at the source code, but if anyone can help me with this i'll be very grateful.
                Thanks

                • 5. Re: Clustering Question
                  integ Newbie

                  I think the bug is in ClusterManager.findSession() method..i guess you do not need to call sessions.remove(id) nad removeSession(id) before session.setId() -> setId() anyways removes the session from the local and distributed store using ClusterManager.remove()
                  So commenting sessions.remove(id) & removeSession(id) should do the trick.I'll submit this as a bug anyways.