TomEE
  1. TomEE
  2. TOMEE-609

Session replication is not working

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0
    • Fix Version/s: 1.5.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows 7, Windows Server 2008, java version "1.6.0_21"

      Description

      Session is not replicated with standart Cluster configuration:
      <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
      The application has <distributable/> tag in web.xml, but it is absent in effective web.xml. (logEffectiveWebXml="true")
      Cluster members can find eachother, session is created, but there is no session backup on another member. I have checked it with "manager" application.
      Replication in the same application with same configuration deployed under tomcat 7.0.29 works as expected.

      1. effective-web.xml
        22 kB
        Dmitry Volkov
      2. example.war
        808 kB
        Dmitry Volkov

        Activity

        Hide
        Howard W. Smith, Jr. added a comment -

        True, thanks Romain. Just download and will review/test, ASAP.

        Show
        Howard W. Smith, Jr. added a comment - True, thanks Romain. Just download and will review/test, ASAP.
        Hide
        Romain Manni-Bucau added a comment -

        @Howard: not sure about a test case but the attached files have the info you want i guess

        Show
        Romain Manni-Bucau added a comment - @Howard: not sure about a test case but the attached files have the info you want i guess
        Hide
        Howard W. Smith, Jr. added a comment -

        Interesting issue and discussion here. Romain, can you tell me where I can download TomEE's test case for cluster and session replication?

        Show
        Howard W. Smith, Jr. added a comment - Interesting issue and discussion here. Romain, can you tell me where I can download TomEE's test case for cluster and session replication?
        Hide
        Ihor Kolodyuk added a comment -

        Dear Romain,

        it works for both cases now also with explicit declaration, I did a wrong check last time today,

        once again thank you very much, you are cool

        Show
        Ihor Kolodyuk added a comment - Dear Romain, it works for both cases now also with explicit declaration, I did a wrong check last time today, once again thank you very much, you are cool
        Hide
        Romain Manni-Bucau added a comment -

        hmm can you retry with next snapshot please? think a line was not commited, should be better now

        Show
        Romain Manni-Bucau added a comment - hmm can you retry with next snapshot please? think a line was not commited, should be better now
        Hide
        Ihor Kolodyuk added a comment -

        Dear Romain,

        thanks a lot for your efforts, you did a trick
        just tested snapshot
        https://repository.apache.org/content/repositories/snapshots/org/apache/openejb/apache-tomee/1.5.2-SNAPSHOT/apache-tomee-1.5.2-20130207.041023-62-plus.zip
        and this works in case if I remove explicit cluster listeners, in fact the variant without explicit listenteners is also good for me so it's ok, but it seems that explicit specifing of cluster listeners still not working (at least for snapshot 1.5.2-20130207.041023-62-plus ), anyway you helped me a lot,
        big thanks

        Show
        Ihor Kolodyuk added a comment - Dear Romain, thanks a lot for your efforts, you did a trick just tested snapshot https://repository.apache.org/content/repositories/snapshots/org/apache/openejb/apache-tomee/1.5.2-SNAPSHOT/apache-tomee-1.5.2-20130207.041023-62-plus.zip and this works in case if I remove explicit cluster listeners, in fact the variant without explicit listenteners is also good for me so it's ok, but it seems that explicit specifing of cluster listeners still not working (at least for snapshot 1.5.2-20130207.041023-62-plus ), anyway you helped me a lot, big thanks
        Hide
        Romain Manni-Bucau added a comment -

        Thanks, i just commited a fix about it.

        I think it comes from the fact you explicitely specified the cluster listeners (if you remove it it should work without the fix).

        Can you give it a try please?

        Show
        Romain Manni-Bucau added a comment - Thanks, i just commited a fix about it. I think it comes from the fact you explicitely specified the cluster listeners (if you remove it it should work without the fix). Can you give it a try please?
        Hide
        Ihor Kolodyuk added a comment -

        Romain, thanks for so quick responce.

        Application:
        http://77047754c838ee6badea32b5afab1882.app.stage.jelastic.com/xssu/cross/download/RTYYHFA1AlxVUAhPYgBqEEBHABMJGEJBABVlH34lJQ8QQBADDwQBQmNTTEBI

        Config (included to server.xml, was earlier working for both TomEE and Tomcat 7):

        <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"
        channelSendOptions="4">
        <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="$

        {MagicPort}

        "
        frequency="500"
        dropTime="3000"/>
        <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver"
        address="$

        {ReceiverIp}

        "
        port="4000"
        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"/>
        </Channel>
        <Valve className="org.apache.catalina.ha.tcp.ReplicationValve"
        filter=""/>
        <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>

        Show
        Ihor Kolodyuk added a comment - Romain, thanks for so quick responce. Application: http://77047754c838ee6badea32b5afab1882.app.stage.jelastic.com/xssu/cross/download/RTYYHFA1AlxVUAhPYgBqEEBHABMJGEJBABVlH34lJQ8QQBADDwQBQmNTTEBI Config (included to server.xml, was earlier working for both TomEE and Tomcat 7): <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster" channelSendOptions="4"> <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="$ {MagicPort} " frequency="500" dropTime="3000"/> <Receiver className="org.apache.catalina.tribes.transport.nio.NioReceiver" address="$ {ReceiverIp} " port="4000" 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"/> </Channel> <Valve className="org.apache.catalina.ha.tcp.ReplicationValve" filter=""/> <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>
        Hide
        Romain Manni-Bucau added a comment -

        What's the app? Which conf?

        Show
        Romain Manni-Bucau added a comment - What's the app? Which conf?
        Hide
        Ihor Kolodyuk added a comment -

        Dear Romain, Dmitry
        session replication still not working for any snapshots of version 1.5.2 (tried all versions), it worked in earlier versions of TomEE but now it's not.
        it works like a charm on latest Tomcat7
        Weird thing that clastering is working (I can see members can detect each other in cluster, but no session replication)
        Can you please re-check if your commit is also available in 1.5.2?

        Show
        Ihor Kolodyuk added a comment - Dear Romain, Dmitry session replication still not working for any snapshots of version 1.5.2 (tried all versions), it worked in earlier versions of TomEE but now it's not. it works like a charm on latest Tomcat7 Weird thing that clastering is working (I can see members can detect each other in cluster, but no session replication) Can you please re-check if your commit is also available in 1.5.2?
        Hide
        Dmitry Volkov added a comment -

        Just tested snapshot, and it works as expected. Great job, thank you!

        Show
        Dmitry Volkov added a comment - Just tested snapshot, and it works as expected. Great job, thank you!
        Show
        Romain Manni-Bucau added a comment - you can give it a try on https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.5.1-SNAPSHOT/apache-tomee-1.5.1-20121208.041528-103-webprofile.zip
        Hide
        Romain Manni-Bucau added a comment -

        just commited a fix on trunk

        Show
        Romain Manni-Bucau added a comment - just commited a fix on trunk
        Hide
        Romain Manni-Bucau added a comment -

        that's because tomee adds by default a cluster listener (will work on it soon)

        a workaround if to configure manually the following:

        addClusterListener(new JvmRouteSessionIDBinderListener());
        addClusterListener(new ClusterSessionListener());
        addValve(new JvmRouteBinderValve());
        addValve(new ReplicationValve());

        (gave the code since i think it is easy enough to understand but can be done by conf IIRC)

        Show
        Romain Manni-Bucau added a comment - that's because tomee adds by default a cluster listener (will work on it soon) a workaround if to configure manually the following: addClusterListener(new JvmRouteSessionIDBinderListener()); addClusterListener(new ClusterSessionListener()); addValve(new JvmRouteBinderValve()); addValve(new ReplicationValve()); (gave the code since i think it is easy enough to understand but can be done by conf IIRC)
        Hide
        Dmitry Volkov added a comment -

        Ihave tested provided version.
        I can see Replication activity in log now:

        Manager localhost#/example: create session message [EB92C91EEF177648EAA8C9D26C68C584] delta request.
        Assuming clocks are synched: Replication for EB92C91EEF177648EAA8C9D26C68C584-1354903085220 took=1 ms.

        But there are still no session replicas visible in manager app.

        Show
        Dmitry Volkov added a comment - Ihave tested provided version. I can see Replication activity in log now: Manager localhost#/example : create session message [EB92C91EEF177648EAA8C9D26C68C584] delta request. Assuming clocks are synched: Replication for EB92C91EEF177648EAA8C9D26C68C584-1354903085220 took=1 ms. But there are still no session replicas visible in manager app.
        Show
        Romain Manni-Bucau added a comment - here the binaries: https://repository.apache.org/content/repositories/orgapacheopenejb-124/org/apache/openejb/apache-tomee/1.5.1/
        Hide
        Romain Manni-Bucau added a comment -

        just commited about itn think i found why you've got the issue, trying to push some binaries then will let you know where to get them to give it a try

        Show
        Romain Manni-Bucau added a comment - just commited about itn think i found why you've got the issue, trying to push some binaries then will let you know where to get them to give it a try
        Hide
        Dmitry Volkov added a comment -

        Yes, I have read these docs. /docs/cluster-howto.html states:

        Simply add <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> to your <Engine> or your <Host> element to enable clustering.
        Using the above configuration will enable all-to-all session replication using the DeltaManager to replicate session deltas.

        I have tested the same application and the same configuration in tomcat 7.0.29 (not TomEE) and it has worked as expected.

        Show
        Dmitry Volkov added a comment - Yes, I have read these docs. /docs/cluster-howto.html states: Simply add <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> to your <Engine> or your <Host> element to enable clustering. Using the above configuration will enable all-to-all session replication using the DeltaManager to replicate session deltas. I have tested the same application and the same configuration in tomcat 7.0.29 (not TomEE) and it has worked as expected.
        Hide
        Romain Manni-Bucau added a comment -

        think that's just because simple tcp cluster doesn't mean session replication in tomcat 7

        did you give a look to

        /docs/cluster-howto.html (simple how to)
        /docs/config/cluster.html (reference documentation)

        ?

        Show
        Romain Manni-Bucau added a comment - think that's just because simple tcp cluster doesn't mean session replication in tomcat 7 did you give a look to /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) ?
        Hide
        Dmitry Volkov added a comment -

        Just tested with the last Snapshot, with same result.
        To reproduce the Issue:
        1. Install two instances of TomEE Webprofile
        2. Uncomment "<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>" in server.xml in both instances
        3. Change HTTP, AJP and shutdown ports in server.xml of one of the instances
        4. Copy example.war into webapps folder of both TomEE instances
        5. Start servers.
        6. Open /example application context path of the first TomEE instance
        7. Check /manager/html/sessions?path=/example of the first TomEE instance - There is one session of type Primary.
        8. Check /manager/html/sessions?path=/example of the second TomEE instance - There is no session of type Backup.

        Show
        Dmitry Volkov added a comment - Just tested with the last Snapshot, with same result. To reproduce the Issue: 1. Install two instances of TomEE Webprofile 2. Uncomment "<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>" in server.xml in both instances 3. Change HTTP, AJP and shutdown ports in server.xml of one of the instances 4. Copy example.war into webapps folder of both TomEE instances 5. Start servers. 6. Open /example application context path of the first TomEE instance 7. Check /manager/html/sessions?path=/example of the first TomEE instance - There is one session of type Primary. 8. Check /manager/html/sessions?path=/example of the second TomEE instance - There is no session of type Backup.
        Hide
        Romain Manni-Bucau added a comment -

        weird, looked through JMX in webmodule the memory web.xml (+checked through a debugger the merged model) and got the distributable

        Show
        Romain Manni-Bucau added a comment - weird, looked through JMX in webmodule the memory web.xml (+checked through a debugger the merged model) and got the distributable
        Hide
        Dmitry Volkov added a comment -
        Show
        Dmitry Volkov added a comment - Just tested with this snapshot: https://repository.apache.org/content/groups/snapshots/org/apache/openejb/apache-tomee/1.5.1-SNAPSHOT/apache-tomee-1.5.1-20121126.041659-86-webprofile.zip have same result. See my effective-web.xml attachment.
        Hide
        Romain Manni-Bucau added a comment -

        Hi,

        just tested your app on the snapshot,

        the clustering seems to work, the loaded web.xml contains distributable

        can you give it a try on the snapshot before going further please?

        Show
        Romain Manni-Bucau added a comment - Hi, just tested your app on the snapshot, the clustering seems to work, the loaded web.xml contains distributable can you give it a try on the snapshot before going further please?

          People

          • Assignee:
            Unassigned
            Reporter:
            Dmitry Volkov
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development