Sticky sessions not working
lexsoto Aug 9, 2011 3:44 PMHello,
We are running into a problem where sticky sessions are not being honored by mod-cluster, or so we think.
Our environment:
- Apache/2.2.16
- JBoss 5.1.0.GA
- ModCluster: 1.1.2.Final
Our web app is deployed in 2 JBoss servers:
- jvmRoute: "gsuat01" with IP 10.151.4.210
- jvmRoute: "gsuat02" with IP 10.151.4.211
Enabling header loggins on the JBoss servers show
2011-08-08 15:00:55,027 TRACE [org.jboss.web.tomcat.service.session.JvmRouteValve] (ajp-0.0.0.0-8009-34) handleJvmRoute(): We have detected a failover with different jvmRoute. old one: gsuat02 new one: gsuat01. Will reset the session id.
and intermittently:
2011-08-08 15:00:55,850 WARN [org.jboss.web.tomcat.service.session.distributedcache.impl.jbc.CacheListener] (Incoming-7,10.151.4.210:46709) Possible concurrency problem: Replicated version id 86 is less than or equal to in-memory version for session USER01
The logs from httpd show that the wrong server is selected:
[Tue Aug 09 10:25:20 2011] [debug] mod_proxy_cluster.c(1839): cluster: Found value Gy1807FDGdCfgW34aGU2ow__.gsuat02 for stickysession JSESSIONID|jsessionid
[Tue Aug 09 10:25:20 2011] [debug] mod_proxy_cluster.c(1839): cluster: Found value Gy1807FDGdCfgW34aGU2ow__.gsuat02 for stickysession JSESSIONID|jsessionid
[Tue Aug 09 10:25:20 2011] [debug] mod_proxy_cluster.c(1441): proxy: byrequests balancer DONE (ajp://10.151.4.210:8009)
[Tue Aug 09 10:25:20 2011] [debug] mod_proxy.c(993): Running scheme balancer handler (attempt 0)
[Tue Aug 09 10:25:20 2011] [debug] mod_proxy_ajp.c(644): proxy: AJP: serving URL ajp://10.151.4.210:8009/
[Tue Aug 09 10:25:20 2011] [debug] proxy_util.c(1999): proxy: AJP: has acquired connection for (10.151.4.210)
[Tue Aug 09 10:25:20 2011] [debug] proxy_util.c(2055): proxy: connecting ajp://10.151.4.210:8009/ to 10.151.4.210:8009
[Tue Aug 09 10:25:20 2011] [debug] proxy_util.c(2153): proxy: connected / to 10.151.4.210:8009
[Tue Aug 09 10:25:20 2011] [debug] proxy_util.c(2308): proxy: AJP: fam 2 socket created to connect to 10.151.4.210
Notice the session id refers to "gsuat02" but the request is being sent (wrongly) to 10.151.4.210 which corresponds to "gsuat01"
Our httpd configuration is:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule slotmem_module modules/mod_slotmem.so
LoadModule manager_module modules/mod_manager.so
LoadModule proxy_cluster_module modules/mod_proxy_cluster.so
<VirtualHost *:80>
ProxyPass / balancer://internalCluster/
<Location /mod_cluster-manager>
SetHandler mod_cluster-manager
Order deny,allow
Deny from all
Allow from 10.151.4.
</Location>
</VirtualHost>
Maxsessionid 250
Maxnode 75
Maxhost 75
UseAlias 1
Listen 10.151.4.160:6666
<VirtualHost 10.151.4.160:6666>
ErrorLog logs/mod_cluster-error_log
CustomLog logs/mod_cluster-access_log combined
<Directory />
Order deny,allow
Deny from all
Allow from 10.151.4.
</Directory>
ManagerBalancerName internalCluster
KeepAliveTimeout 60
MaxKeepAliveRequests 0
LogLevel debug
</VirtualHost>
and in our mod-cluster configuration at the JBoss side we have:
<bean name="ModClusterConfig" class="org.jboss.modcluster.config.ha.HAModClusterConfig" mode="On Demand">
<property name="proxyList">${jboss.mod_cluster.proxyList:}</property>
<property name="advertise">false</property>
<property name="advertiseGroupAddress">${jboss.mod_cluster.advertise.address,jboss.partition.udpGroup:224.0.1.105}</property>
<property name="advertisePort">${jboss.mod_cluster.advertise.port:23364}</property>
<property name="excludedContexts">${jboss.mod_cluster.excludedContexts:JBOSS,localhost:ROOT,admin-console,invoker,jbossws,jmx-console,juddi,web-console}</property>
<property name="autoEnableContexts">${jboss.mod_cluster.autoEnableContexts:true}</property>
<property name="ssl">false</property>
<property name="stickySession">true</property>
<property name="stickySessionForce">false</property>
<property name="stickySessionRemove">false</property>
<property name="maxAttempts">1</property>
<property name="workerTimeout">-1</property>
<property name="nodeTimeout">-1</property>
</bean>
Mod cluster manager DUMP output page shows both JBoss servers:
Node: [6],Name: gsuat02,Balancer: internalCluster,LBGroup: ,Host: 10.151.4.211,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 253,Read: 4828840,Transfered: 547741,Connected: 0,Load: 82
Node: [13],Name: gsuat01,Balancer: internalCluster,LBGroup: ,Host: 10.151.4.210,Port: 8009,Type: ajp,Flushpackets: Off,Flushwait: 10,Ping: 10,Smax: 1,Ttl: 60,Elected: 264,Read: 7219247,Transfered: 800564,Connected: 0,Load: 78
Any help will be appreciated. Are we doing anything wrong? Anybody running into the same issue out there?
Thanks in advance,
Alex Soto