Bug 36507 - mod_proxy_balancer does not handle sticky sessions with tomcat correctly
mod_proxy_balancer does not handle sticky sessions with tomcat correctly
Status: RESOLVED FIXED
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_balancer
2.1-HEAD
Other other
: P2 major (vote)
: ---
Assigned To: Apache HTTPD Bugs Mailing List
: PatchAvailable
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2005-09-05 17:41 UTC by Christoph Bachhuber-Haller
Modified: 2005-10-06 15:21 UTC (History)
1 user (show)



Attachments
Patch against trunk (1.09 KB, patch)
2005-09-28 23:17 UTC, Rüdiger Plüm
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Bachhuber-Haller 2005-09-05 17:41:35 UTC
Apache Tomcat uses JSESSIONID values like
95C5BB2B084DB06938BF798FCF3B3994.tomcat2 for sticky sessions. "tomcat2" is the
route set in jvmRoute in the Engine element in server.xml. 

I expected that mod_proxy_balancer would match its path argument against the
part after the . from JSESSIONID, but it tries to match against the whole cookie
and fails obviousely. (in httpd-2.1.6-alpha/modules/proxy/mod_proxy_balancer.c,
find_route_worker function)

That way, balancer is useless as a replacement for mod_jk load balancing with
sticky sessions.
Comment 1 Rüdiger Plüm 2005-09-28 23:17:33 UTC
Created attachment 16546 [details]
Patch against trunk

I can confirm this problem.
The attached patch should fix this. Can you please give it a try?
Comment 2 Christoph Bachhuber-Haller 2005-10-04 14:47:58 UTC
Hi Ruediger,

(In reply to comment #1)
> Created an attachment (id=16546) [edit]
> Patch against trunk
> 
> I can confirm this problem.
> The attached patch should fix this. Can you please give it a try?

I can confirm that this patch fixes my problem. Thank you very much! I wonder
though whether the tomcat session id format is any standard or if apache should
support sticky sessions for load balancing in a more generic way. 

Bye,
Christoph
Comment 4 Ruediger Pluem 2005-10-06 23:14:45 UTC
Committed and backported to 2.2.x branch (r306888).
Comment 5 Ruediger Pluem 2005-10-06 23:21:00 UTC
> though whether the tomcat session id format is any standard or if apache should
> support sticky sessions for load balancing in a more generic way. 

It does. As you can choose the name of the cookie you can make any application
where you can set a cookie work with that. Just set cookie BLAH=a.route in your
application. Of course it is more convenient if the application container is
able to do this (like Tomcat). BTW: I know no standard for coding such routing
information inside a cookie. But if you know one I would be interested to get it
known.