Tomcat, JRuby, and session rebinding problem

I am having a session related problem with a JRuby 1.1.3
application on CentOS 5.2 under Tomcat 5.5.25 (Jpackage rpms)
with Sun Java 1.6.0.7. When a server is taken out of service, any
session that is bound to that tomcat server is rebound to a
surviving tomcat server and the user gets a new JSESSIONID
cookie. None of the previous session data is available to that
new JSESSIONID and the user starts their session over.

I have duplicated this on at test environment. With one user
accessing the app, I can see one session from Jconsole under
Catalina.Manager./.localhost.Operations listSessionIDs. After
shuting down the server that I was bound to, I lose my session
and reenter my information. I now see two sessions in
Jconsole. One of the sessions has my old sessionid matching my
old JESSIONID cookie, except with the new JVMRoute on the
end. The second session is the new one that matches the new
JESSIONID cookie.

So for example, starting with both servers up, I connect and get
JESSIONID = 05C8CDD96672454740C29450518751BA.qc-gd1. I put in
some data and navagate around the app. I stay on the qc-gd1
server. In jconsole, on both servers I see one session with the
above id.

I shutdown qc-gd1, and then access the app again. The first
request seems fine. Looking at the cookies returned, I see a new
JSESSIONID = 40EA5E4603F1D5B6ED474D4E7A33DEE2.qc-gd2 is set. In
Jconsole I see two sessions now. One is
05C8CDD96672454740C29450518751BA.qc-gd2 and the other is
40EA5E4603F1D5B6ED474D4E7A33DEE2.qc-gd2.

If I turn off rebinding in tomcat by commenting out the following
lines in server.xml, I no longer see this problem.

The JvmRoute portion of the JESSIONID cookie (qc-gd2) is intended
to allow mod_jk to “stick” sessions to a host/jvm for it’s
lifetime. It seems like the mapping between Java sessions and
JRuby sessions is including that portion of the JESESSIONID and
thus when sessions rebind and get a new JvmRoute, the session
mapping is broke and a new session gets created. Does anyone have
any pointers to documentation on how those session mappings between
tomcat and JRuby work?

Any pointers on how to get session rebinding to work?

Thanks
Ben J.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email