Jetty
  1. Jetty
  2. JETTY-513

Terracotta session replication does not work when the initial page on each server does not set any attributes

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.7
    • Fix Version/s: 6.2.0pre0, 6.1.8
    • Component/s: None
    • Labels:
      None
    • Environment:
    • Patch Submitted:
      Yes
    • Number of attachments :
      3

      Description

      Terracotta session replication does not work with jetty 6.1.7 if the initial page visited at each server does not add attributes into the session state, but subsequent pages then add attributes. Each server must be visited before any server adds an attribute.

      This is caused by a combination of TerracottaSessionManager.SessionData being constructed with a null attributes map, and TerracottaSessionManager.Session referencing that map on construction. When attributes are created, they may be created independently in the Session and the shared SessionData.

      The attached file contains a webapp and the configuration and steps used to reproduce the problem. It also includes a patch that fixes the problem by always creating an attributes map SessionData on construction (there is probably a better way to fix this, but the patch works around the problem for me).

      This is always reproducible if the exact sequence below is followed.

      Steps:

      1. Start a single terracotta server on port 9990 with terracotta-config.xml

      2. For each jetty installation

      • copy greeting.xml into the contexts directory
      • copy greeting.war into the webapps directory
      • copy jetty-terracotta-sessions-6.1.7.jar into lib/ext

      3. Start jetty server 1 on port 9001 (run-jetty1.sh)
      4. Start jetty server 2 on port 9002 (run-jetty2.sh)
      5. Browse to http://localhost:9001/greeting/
      6. Browse to http://localhost:9002/greeting/

      7. Submit a name several times to server 1
      (http://localhost:9001/greeting/index.jsp?name=bob)

      • The counter increments for each submit.

      8. Submit a name several times to server 2
      (http://localhost:9002/greeting/index.jsp?name=bob)

        • State is not replicated to the 2nd server. The counter starts at 1

        Activity

        Hide
        Eugene Kuleshov added a comment -

        There is now more complete and more transparent Terracotta integration module for jetty available at the Terracotta Forge site [1]. I wonder if code from jetty contrib should be removed now or if it should provide link to the new stuff and accordingly update the wiki pages.

        Though it would be great to have Jetty developers involved with the code at Terracotta Forge.

        [1] http://forge.terracotta.org/projects/tim-jetty-6.1.4/

        Show
        Eugene Kuleshov added a comment - There is now more complete and more transparent Terracotta integration module for jetty available at the Terracotta Forge site [1] . I wonder if code from jetty contrib should be removed now or if it should provide link to the new stuff and accordingly update the wiki pages. Though it would be great to have Jetty developers involved with the code at Terracotta Forge. [1] http://forge.terracotta.org/projects/tim-jetty-6.1.4/
        Hide
        Ross Black added a comment -

        I created the same bug at Terracotta Forge.
        https://jira.terracotta.org/jira/browse/FORGE-181

        Show
        Ross Black added a comment - I created the same bug at Terracotta Forge. https://jira.terracotta.org/jira/browse/FORGE-181
        Hide
        Jan Bartel added a comment -

        Ross,

        Firstly let me say "Thank You!" for such an excellent jira report! If only all bug-raisers were as thorough as you. Your analysis was spot-on and providing the test webapp made it so much faster and easier to fix.

        I've committed the fix (with a couple of minor differences to your patch) to both jetty trunk, and to the jetty6.1 branch.

        I'll attach the final patch I applied here, so that perhaps the terracotta forge can pick it up too.

        cheers
        Jan

        Show
        Jan Bartel added a comment - Ross, Firstly let me say "Thank You!" for such an excellent jira report! If only all bug-raisers were as thorough as you. Your analysis was spot-on and providing the test webapp made it so much faster and easier to fix. I've committed the fix (with a couple of minor differences to your patch) to both jetty trunk, and to the jetty6.1 branch. I'll attach the final patch I applied here, so that perhaps the terracotta forge can pick it up too. cheers Jan
        Hide
        Jan Bartel added a comment -

        Final patch that was applied to Jetty svn.

        Show
        Jan Bartel added a comment - Final patch that was applied to Jetty svn.

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Ross Black
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: