Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-4428

Method org.jboss.web.tomcat.tc5.session.ClusteredSession.calcMaxUnreplicatedInterval incorrectly treats maxInactiveInterval as milliseconds


    • Estimated Difficulty:


      When running the testsuite test org.jboss.test.cluster.test.ScopedSetTriggerTestCase, the test fails on the following assertion:

      junit.framework.ComparisonFailure: Attributes should be the same expected:<...Ben...> but was:<...Joe...>
      at org.jboss.test.cluster.test.ScopedSetTriggerTestCase.testNonPrimitiveModify(ScopedSetTriggerTestCase.java:94)
      at junit.extensions.TestDecorator.basicRun(TestDecorator.java:22)
      at junit.extensions.TestSetup$1.protect(TestSetup.java:19)
      at junit.extensions.TestSetup.run(TestSetup.java:23)

      This failure occurs when running on the Unisys MCP system, which demonstrates different timings than when running on a system like Windows.

      After analyzing the results and the code, the following appears to be the root cause of the test failure:

      org.jboss.web.tomcat.tc5.session.ClusteredSession has a method calcMaxUnreplicatedInterval that is used to calculate maxUnreplicatedInterval. maxUnreplicatedInterval is the maximum time interval before a session is replicated to the other cluster nodes. When this time period is exceeded, the session is replicated even if the session is not "dirty". maxUnreplicatedInterval is in milliseconds, but maxInactiveInterval is in seconds. However, calcMaxUnreplicatedInterval computes maxUnreplicatedInterval as follows:
      maxUnreplicatedInterval = maxInactiveInterval * maxUnreplicatedFactor / 100;
      where maxUnreplicatedFactor is 80. Since maxInactiveInterval is in seconds, the correct computation should be:
      maxUnreplicatedInterval = maxInactiveInterval * 1000 * maxUnreplicatedFactor / 100;
      As a result of the incorrect computation of maxUnreplicatedInterval, the session is automatically replicated much more often than was intended.

      In this case, the session timeout was configured as 30 minutes or 1800 seconds. So, maxUnreplicatedInterval becomes 1440 milliseconds. Therefore, if the test takes more than about a second and a half to run, the test will not produce the expected results.

        Gliffy Diagrams




              • Assignee:
                brian.stansberry Brian Stansberry
                burdeasa Stephen Burdeau
              • Votes:
                0 Vote for this issue
                0 Start watching this issue


                • Created: