title: Tomcat 6: Max Session Idle time different between instances
body: <p>I am using HttpSession's with Tomcat 6. The first instance of Tomcat 6 that I deployed my web application in had the behavior I would expect for my Tomcat sessions (I set a maxInactiveInteval on my session to 30 minutes).</p>
  
  <blockquote>
    <p><strong>Update</strong>: I added more code to the following to demonstrate exactly how I'm setting this timeout on a session</p>
  </blockquote>
  
  <p>This is how I first setup the session:</p>
  
  <pre><code>session = request.getSession(true);
  session.setAttribute(USER_CREDENTIALS, new Credentials(username, password));
  session.setMaxInactiveInterval(60*30);
  </code></pre>
  
  <p>I then have an interceptor which checks this session:</p>
  
  <pre><code>HttpSession session = request.getSession(true);
  Credentials cred = (Credentials) session.getAttribute(AuthController.USER_CREDENTIALS);
  </code></pre>
  
  <p>Seems to work fine in the Tomcat instance I devloped with, but in another instance of Tomcat 6, in a load balanced environment, the  maxInactiveInteval doesn't seem to be respected. </p>
  
  <blockquote>
    <p><strong>Update:</strong> What I mean is that the users session expires if the user is inactive (no new requests) for approximately ten seconds. </p>
  </blockquote>
  
  <p>There is no where else in the code where  maxInactiveInteval is set. What could be causing this behavior?</p>