Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat sessions expiring unexpectedly

We are running tomcat application server that handle over 100 concurrent sessions. In the last 2 months the most active users noticed that sometimes they are getting kicked off from the system.

As I understood from the log tomcat sessions are getting expired without any reason.

I see no problems from the web application side. Is there any problem from the tomcat side?

Tomcat 6.0.18.

like image 372
Bogdan Gusiev Avatar asked Jun 06 '09 07:06

Bogdan Gusiev


People also ask

What is session timeout in Tomcat?

By default the session time-out is set to 30 minutes. To change the Tomcat session time-out, edit the $TOMCAT_HOME/conf/web.xml file and change the values in the session section: <!-- You can set the default session timeout (in minutes) for all newly --> <!--

What is session in Tomcat?

A Session is the Catalina-internal facade for an HttpSession that is used to maintain state information between requests for a particular user of a web application.


2 Answers

If there has been no code chance triggering this, I would look at memory usage. This might be the effect of Tomcat running out of memory and invalidating sessions to recover.

If at all possible monitor garbage collections, and/or put surveillance on with jconsole or jvisualvm.

like image 155
Thorbjørn Ravn Andersen Avatar answered Oct 12 '22 02:10

Thorbjørn Ravn Andersen


A possible cause is that you put in the session an object that does NOT implement the Serializable interface. Tomcat occasionally writes some of the sessions on the disk. If a session contains non-serializable objects it will simply be removed from the container (because of the NotSerializableException). If this is happening you should see the Exception in the tomcat log file.

like image 34
idrosid Avatar answered Oct 12 '22 01:10

idrosid