You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Keith Winton <kw...@eonegroup.com> on 2004/09/05 14:38:57 UTC

sessions invalidated but still show active in manager, valueUnbound in HttpSessionBindingListener not invoked for very long time

Using tomcat 5.0.25, the tomcat manager shows a very large number of active
sessions (>1000).  For various reasons (reporting, the objects we cache in
the session, etc.) this is not desirable.  Via valueBound() in an
HttpSessionBindingListener, I've maintained a weak hashmap of sessions, and
I remove from this map via valueUnbound().

When I iterate over the map, and try to retrieve the maxInactiveInterval for
the session objects, only 19 of them don't throw a "Session already
invalidated" error.

The "real" problem is that one of the reporting needs is to report on real
session invalidation time, and on activity based on objects stored in the
session.  Both in this reporting process, and in the simple .jsp writing to
do the iteration mentioned above, these hundreds of invalid sessions take a
very, very long time to attempt to access the maxInactiveInterval
(eventually throwing an exception), so that just to iterate through the list
takes two hours.  Here is an example of that iteration, where for each entry
in iter() loop I print out the current time and the session
maxInactiveInterval.  You can see that, as expected, it is very fast to do
this simple iteration on the first two entries shown below, but it took two
seconds to "time out" on the third entry.  This means that the real-time
reporting we need to do won't work.

...
Got next entry-20:26:54.271
idleTime-8.0
Got next entry-20:26:54.271
error-getLastAccessedTime: Session already invalidated
Got next entry-20:26:56.358
idleTime-23.0
Got next entry-20:26:56.359
...




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org