Skip to main content

Glassfish 4 cluster & session replication: session loss when a single instance is restarted

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
bradvido
Offline
Joined: 2011-08-25

I'm using Glassfish 4.
I have a 3 instance cluster spread across 2 nodes. I have a HAProxy load balancer in front of the cluster which distributes the request round-robin. I've been testing session replication with the clusterjsp .ear file and session replication is working great (until I restart an instance).

1. I start the cluster using asadmin start-cluster mycluster. All instances start. The session data I enter in the the HaJsp.jsp page gets replicated across all three instances.
2. I stop instance1 using asadmin stop-instance instance1. I reload HaJsp.jsp a few times and see intance1 is no longer serving any requests and intance2 & 3 still have the session data maintained.
3. I start instance1 using asadmin start-instance instance1. I reload HaJsp.jsp and if it loads from instance2 or 3, the session data is maintained. But the next time it loads from instance1, it creates a new session and loses the session data.

It seems like once instance1 is restarted it's not syncing with the other two instances to get a copy of the current session data.

I have read this post: https://www.java.net/forum/topic/glassfish/glassfish/clustering-and-sess... which suggests that at least 2 instances need to be alive forthe session to persist and in my case two instances are always running.

Thanks for any help you can provide.

-Brady