When do tabs expire

when do tabs expire

Tomcat - sessions do not expire

Post by: Wim Folkerts, Greenhorn

on Mar 10, 2010 05:58:33

Hello,

Last week we've implemented a sessionListener implementing the HttpSessionListener interface. This week I found out a lot of sessions are not expired at all. In the Tomcat logging I print a line with date/time and sessionID when the session is created and the same when a session is destroyed. However based on the session ID I find out a lot of sessions are not destroyed at all. We know that most users do not use the logout functionality (who does). So in most cases the browser is just closed and the session should be expired after 30 mins of inactivity.

We're using Tomcat 6.0.18 and in the. /conf/web.xml we've confirgured the sessionTimeout as follows:

<session-config>

</session-config>

I've tried to reproduce this problem on my local environment, but all sessions does expires as expected. Note that a lot of users are using Citrix. Could that cause the problem we have as the user has activated a session as a system account instead of a user account?

Any advice would be appreciated.

-WFO

Post by: Jaikiran Pai, Marshal

on Mar 10, 2010 08:51:17

Wim Folkerts wrote: So in most cases the browser is just closed and the session should be expired after 30 mins of inactivity.

I've tried to reproduce this problem on my local environment, but all sessions does expires as expected.

Are you sure that the browser session is closed? A wild guess (i don't know the details of your app)

- maybe the browser is left open and your client application keeps sending a behind the scenes request to the server, which results in the session remaining active.

Post by: Wim Folkerts, Greenhorn

on Mar 11, 2010 00:59:43

Yes, I'm very sure the browser is closed. Just for you info - I managed to reproduce this also on the production environment. I also found out it has nothing to do with Citrix as it also happens in our internal network. So the situation is that a lot of sessions on our production environment are not closed while this is not the case on my local development environment . We've been migrated from Websphere 4.0 to Tomcat 6 for about 4 months. We had the problems before the Inital heap was increased to 256 MB and the Max Stack to 512 MB where Tomcat just went down due to the high number of process but now we got issue where the max number of DB connections was exceeded; ORA-00020: maximum number of processes (500) exceeded

Btw I found an example servlet to close 'stale' sessions. But it would be better to find the root cause.

import java.util.*;

import javax.servlet.*;

import javax.servlet.http.*;

public class ManualInvalidate extends HttpServlet <

public void doGet(HttpServletRequest req, HttpServletResponse res)

throws ServletException, IOException <

res.setContentType("text/html");

PrintWriter out = res.getWriter();

// Get the current session object, create one if necessary

HttpSession session = req.getSession(true);

// Invalidate the session if it's more than a day old or has been

// inactive for more than an hour.

Source: www.coderanch.com

Category: Forex

Similar articles: