You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Crane <da...@donorschoose.org> on 2008/01/10 23:46:54 UTC
Tomcat sometimes loses HttpSession when 2 mod_jk workers have different hosts
Has anyone had problems with Tomcat losing the HttpSession when Apache
uses mod_jk configured with 2 normal workers connected to *different*
hosts? I have boiled down to the following test case:
worker.list=customers,staff
worker.customers.type=ajp13
worker.customers.host=host01
worker.customers.port=8009
worker.customers.retries=4
worker.customers.connect_timeout=10000
worker.customers.prepost_timeout=10000
worker.customers.connection_pool_timeout=600
worker.staff.reference=worker.customers
worker.staff.host=host02
This is a simplified version of my Apache directives that route to those
workers:
JkMount /* customers
JkMount /admin/* staff
JkUnMount /images/* customers
The failure surfaces in our code when the Tomcat HttpServletRequest
request.getSession(false) returns null while processing the POST of the
form request. The JSESSION cookie in the browser when the form loaded
was correct, i.e., the same as the value right after I submitted my
successful request to the login form.
Strangely the failure only affects a couple of our /admin/* pages and --
stranger still -- only when worker.list includes both workers and the
host set for those workers is different. If I only activate "staff", it
works. If I change worker.customers.host=host02 to match with "staff",
it works. It doesn't matter if either or both hosts are actually the
localhost or a remote host -- if they differ, there is a failure, but
only for a couple page requests.
Finally, all of these pages worked with the identical JkMount directives
with an older, more complicated version of workers.properties that used
a load-balanced worker pool in place of "customers" (yes, the pool
included a connection to host02).
We have the following platform:
Linux: Red Hat Enterprise Linux ES release 4 (Nahant Update 4)
Kernel 2.6.9-42.0.3.ELsmp
Apache: 2.2.3
Using prefork MPM
Apache Tomcat Connector mod_jk/1.2.21
Tomcat: 5.5.17.0
JVM: 1.5.0_08-b03
Spring: Framework: 1.2.9
Web Flow: 1.0.3
Thanks,
David Crane
DonorsChoose.org