Glassfish Cluster 2.1.1, HttpSessions replication and multi-thread concurrent access
I have several clusters with Glassfish 2.1.1 in a BIG virtual environment and all worked fine … until I add new processors to this clusters. After upgrade, I started to have problems with HttpSession replication. Starting debugging JXTA, Shoal and the Web Container didn’t help at all. Until I found this page Memory Replication & Multi-threaded Concurrent Access to HttpSessions. My applications was doing multi-thread concurrent access some times (Ajax) and this was the root cause of all lost sessions. I modified sun-web.xml from my application, accordingly with the above blog post, and after that httpsession started to work as expected. All what you should do is to add relaxCacheVersionSemantics with true as value.
1 2 3 4 5 6 7 8 9 10 11 12 13
<session-config> <session-manager persistence-type="replicated"> <manager-properties> <property name="persistenceFrequency" value="web-method"/> <property name="relaxCacheVersionSemantics" value="true"/> </manager-properties> <store-properties> <property name="persistenceScope" value="session"/> </store-properties> </session-manager> <session-properties/> <cookie-properties/> </session-config>
Probably in a single processor environment httpsession working very well but on multicore/multiprocessor system you can have problem if you don’t specify relaxCacheVersionSemantics. Read Memory Replication & Multi-threaded Concurrent Access to HttpSessions for more informations.