Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 6.1.7
-
Component/s: None
-
Labels:None
-
Environment:HideLinux sputnik 2.6.23.15-80.fc7 #1 SMP Sun Feb 10 17:29:10 EST 2008 i686 i686 i386 GNU/Linux
java version "1.5.0_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)
ShowLinux sputnik 2.6.23.15-80.fc7 #1 SMP Sun Feb 10 17:29:10 EST 2008 i686 i686 i386 GNU/Linux java version "1.5.0_12" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04) Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode, sharing)
-
Patch Submitted:Yes
-
Number of attachments :
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
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/