Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7C6CE7395 for ; Mon, 15 Aug 2011 18:09:53 +0000 (UTC) Received: (qmail 20709 invoked by uid 500); 15 Aug 2011 18:09:49 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 20326 invoked by uid 500); 15 Aug 2011 18:09:48 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 20310 invoked by uid 99); 15 Aug 2011 18:09:48 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2011 18:09:48 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [138.108.18.166] (HELO mail20.enterprisenet.org) (138.108.18.166) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Aug 2011 18:09:40 +0000 X-IronPort-AV: E=Sophos;i="4.67,375,1309752000"; d="scan'208";a="91696633" Received: from nawincbtmxh01.enterprisenet.org ([10.9.14.103]) by mail20.enterprisenet.org with ESMTP; 15 Aug 2011 14:09:18 -0400 Received: from NAWINCBTMXH001.enterprisenet.org ([10.9.14.158]) by NAWINCBTMXH01.enterprisenet.org with Microsoft SMTPSVC(6.0.3790.3959); Mon, 15 Aug 2011 14:09:18 -0400 Received: from NAWINCBTMSX105.enterprisenet.org ([169.254.5.100]) by NAWINCBTMXH001.enterprisenet.org ([10.9.14.158]) with mapi id 14.01.0289.001; Mon, 15 Aug 2011 14:09:18 -0400 From: "Lataxes, Karl" To: Tomcat Users List Subject: RE: Sticky Session Not Working With Apache 2.0.54 and Tomcat 7.0.8 Thread-Topic: Sticky Session Not Working With Apache 2.0.54 and Tomcat 7.0.8 Thread-Index: AcxBYe3zFjbeVJ4tStie03aoOsZsnQAMFFaAAAWBIRAAAoQaAABJ3IRAAA8/FAAABe8L0AAF384AAqv4mGAADDdogAFOx0fgAKlzhYAAJVKH8AAWl2MAAACtwAAAS3OmsAAwemoAAAE54DAAOTj6AABb7ZkgABJ794AABiFsgA== Date: Mon, 15 Aug 2011 18:09:17 +0000 Message-ID: <34458449103DBF49A4547C6CCE3CA130054D0CE0@NAWINCBTMSX105.enterprisenet.org> References: <34458449103DBF49A4547C6CCE3CA130047B2C6C@NAWINCBTMSX101.enterprisenet.org><4E1DEE1A.4080402@apache.org><34458449103DBF49A4547C6CCE3CA130047B4725@NAWINCBTMSX101.enterprisenet.org><4E204418.3080901@kippdata.de><34458449103DBF49A4547C6CCE3CA130047B4A08@NAWINCBTMSX101.enterprisenet.org><4E209356.1040601@kippdata.de><34458449103DBF49A4547C6CCE3CA130047CAB37@NAWINCBTMSX105.enterprisenet.org><4E32D35F.9080301@ice-sa.com><34458449103DBF49A4547C6CCE3CA130047E1F81@NAWINCBTMSX105.enterprisenet.org><4E400B33.5050004@christopherschultz.net><34458449103DBF49A4547C6CCE3CA13004CF0B41@NAWINCBTMSX105.enterprisenet.org><4E419D46.1080607@kippdata.de> <4E41A1D4.8060804@ice-sa.com><34458449103DBF49A4547C6CCE3CA13004CF1E4D@NAWINCBTMSX105.enterprisenet.org><4E44E182.9000209@kippdata.de><34458449103DBF49A4547C6CCE3CA130054CDDA9@NAWINCBTMSX105.enterprisenet.org><4E4669C0.1060509@kippdata.de> <34458449103DBF49A4547C6CCE3CA130054D0B83@NAWINCBTMSX105.enterprisenet.org> <4E494EB7.4030007@kippdata.de> In-Reply-To: <4E494EB7.4030007@kippdata.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.9.14.240] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 15 Aug 2011 18:09:18.0606 (UTC) FILETIME=[735412E0:01CC5B76] X-Virus-Checked: Checked by ClamAV on apache.org I wrote the code to generate the session id and add it as an HTTP header at= the recommendation of someone on the users list. The problem now is appen= ding the jvmroute to the generated session id in order to get session stick= iness to work. If there were some way for the servlet to retrieve the jvmR= oute from server.xml, I could append it to the session id and get it to wor= k. I have been looking online for a solution, but have been unable to find= one.=20 -----Original Message----- From: Rainer Jung [mailto:rainer.jung@kippdata.de]=20 Sent: Monday, August 15, 2011 12:52 PM To: users@tomcat.apache.org Subject: Re: Sticky Session Not Working With Apache 2.0.54 and Tomcat 7.0.8 On 15.08.2011 17:09, Lataxes, Karl wrote: > Yes, the space before "servlet" is a copy/paste error. >=20 > I made the LogFormat additions to httpd.conf, set the mod_jk logging leve= l to "debug" and ran some additional tests. >=20 > The session id did appear in the access_log I generated: >=20 > 2000-1-200-ap-1313413815567 So the session ID is wrong, it does not contain the trailing ".tomcat7A" to allow sticky routing. Whatever generates the session id doesn't generate a correct one which supp= orts stickyness. The session id doesn't look like a normal Tomcat session i= d, so it seems something else is setting the JSESSIONID cookie, like a cust= om sesion manager. You need to find that piece of code and fix it (to appen= d the jvmRoute to the id). Regards, Rainer > In the mod_jk.log, I also noted several references to the session id,=20 > which are included below. Please note that the original client=20 > request went to worker tomcat7A, but subsequent requests were routed=20 > to tomcat7C >=20 > [Mon Aug 15 09:10:15.614 2011] [3275:1] [debug]=20 > ajp_unmarshal_response::jk_ajp_common.c (723): Header[0] [Set-Cookie]=20 > =3D [JSESSIONID=3D2000-1-200-ap-1313413815567] > [Mon Aug 15 09:10:18.495 2011] [3275:1] [debug] service::jk_lb_worker.c (= 1118): service sticky_session=3D1 id=3D'2000-1-200-ap-1313413815567' > [Mon Aug 15 09:10:18.495 2011] [3275:1] [debug]=20 > get_most_suitable_worker::jk_lb_worker.c (946): searching worker for part= ial sessionid 2000-1-200-ap-1313413815567 [Mon Aug 15 09:10:18.495 2011] [3= 275:1] [debug] get_most_suitable_worker::jk_lb_worker.c (1001): found best = worker tomcat7C (tomcat7C) using method 'Request' >=20 > You can see from the log snippets that "." is not being appe= nded to the session as expected. >=20 > -----Original Message----- > From: Rainer Jung [mailto:rainer.jung@kippdata.de] > Sent: Saturday, August 13, 2011 8:11 AM > To: users@tomcat.apache.org > Subject: Re: Sticky Session Not Working With Apache 2.0.54 and Tomcat=20 > 7.0.8 >=20 > On 12.08.2011 15:30, Lataxes, Karl wrote: >> The jvmRoute's for both server.xmls are properly set to the worker names= and are not commented out. This was the first thing I verified. >> >> >> > jvmRoute=3D"tomcat7C"> >> >> Here are the settings in workers.properties (worker tomcat7A identical t= o tomcat7C except for port, since both are running on the same server for t= esting. In production, we will probably install them on separate boxes): >> >> worker.list=3Dloadbalancer,jkstatus >> worker.tomcat7C.type=3Dajp13 >> worker.tomcat7C.host=3D >> worker.tomcat7C.port=3D4931 >> worker.tomcat7C.lbfactor=3D1 >> worker.loadbalancer.type=3Dlb >> worker.loadbalancer.balance_workers=3Dtomcat7A,tomcat7C >> worker.loadbalancer.sticky_session=3D1 >> worker.jkstatus.type=3Dstatus >=20 > OK >=20 >> Here are the JkMount settings in mod_jk.conf: >> >> JkMount /jkmanager/* jkstatus >> JkMount / servlet/* loadbalancer >=20 > I hope the space before "servlet" is a copy and paste error and not in th= e original config ... >=20 >> Load balancing is working, but subsequent requests from a single client = are being routed to the other Tomcat instance despite sticky_session being = set to 1. >=20 > OK, then maybe your cookie header is not OK. To debug: >=20 > - Add %{Cookie}i to the LogFormat you are using in Apache. It will log al= l cookies. Check the values. >=20 > - Add %{JSESSIONID}C to the same LogFormat. It will log the value of the = JSESSIONID cookie found by the web server. Check the values. >=20 > - Optional: Add %{Set-Cookie}o to the same LogFormat. It will log the set= ting of the cookie (sending a cookie from the server to the client). > Probably of no use for you, since you seem to parse that info in some oth= er way. >=20 > - Increase log level of mod_jk to debug or even trace (not in > production) and look at the log lines written when your client sends a re= quest, which isn't handled sticky. >=20 > Regards, >=20 > Rainer --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org