You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Brennan O'Shea <Br...@alltel.com> on 2000/03/03 22:03:00 UTC

session expiring too quick

To anyone who can help:

I'm running Tomcat 3.1 in NT environment.  I have the following settings in my
"server.xml" file:
defaultSessionTimeOut="500"

and the following in "server.dtd":
defaultSessionTimeOut NMTOKEN "500"

and my sessions time out in just a few minutes (apx. 2-3 minutes).  These were
originally set to "30" and I changed them to "500" and haven't noticed any
change.  Can someone tell me if this is in fact the setting to change in order
to increase the default session timeout and also what units (minutes) this
number is in.  Has anyone else had this problem?

Thanks,
Brennan

Re: session expiring too quick

Posted by Shachor Gal <sh...@techunix.technion.ac.il>.
                                                                            
 First, I do not want to take credit for something that I only fixed (:-))  
but other then that you partially correct, yes we can check the timeout in  
the access() method and it will improve the granularity in some of the
cases, but this is not enough.

Tomcat need also to check and remove stale sessions that the user does not
access anymore, so we need a b/g thread to gc stale sessions. Passing over
all the active sessions in a busy system can be very demanding
so we traded granularity for performance (nobody that I know of
really care about 60 sec's of session time out).

	Gal Shachor

On Fri, 3 Mar 2000, Gary Yang wrote:

> Gary Yang wrote:
> 
> > Shachor Gal wrote:
> >
> > >  I think that I fixed this problem yesterday. So if you will use todays
> > > build it supposed to be there.
> > >
> > > However, the defaultSessionTimeOut in server.xml is not in use anymore,
> > > instead you will need to set the session timeout in web.xml (The servlet
> > > API 2.2 deployment descriptor.)
> > >
> > > Note that you can use TOMCAT_HOME/conf/web.xml to provide default timeout
> > > for all the contexts.
> > >
> > > Tell me if it works (remember this should be in the latest build).
> > >
> > >         Gal Shachor
> > >
> > > On Fri, 3 Mar 2000, Eric Lebetsamer wrote:
> > >
> > > > I noticed this same problem.  I assumed that it is a bug in 3.1.  I had to
> > > > move backwards to 3.0 to fix the problem.  Waiting for a fix.
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
> > Why the minium timeout is 60 seconds? From
> > src/share/org/apache/tomcat/session/StandardManager.java,
> >  it seems that tomcat checks all sessions each 60 seconds. Why don't you check if
> > a session is time out when a new access comes?
> > I mean, why don't you check it in method access() of StandardManager.java?
> 
> Sorry, here should be StandardSession.java.
> 
> >
> >     public void access() {
> >
> >         this.lastAccessedTime = this.thisAccessedTime;
> >         this.thisAccessedTime = System.currentTimeMillis();
> >         this.isNew=false;
> >
> >         if (this.thisAccessedTime-this.lastAccessedTime >
> > this.maxInactiveInterval) {
> >             // timeout ....
> >
> >         }
> >   }
> >
> > If use this method, the minium maxInactiveInterval can be less than 60...the unit
> > can even be ms:-)
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 


tomcat 3.0 or 3.1with j2sdkee?

Posted by linh pham <li...@forte.com>.
hello folks,

has anyone been successful in setting up tomcat to run with Sun's j2sdkee (j2ee reference implementation)?

when starting the server, i get the following error:
	...
	cannot load servlet name: jsp
	J2EE server startup complete.

and when i try to access a jsp, i get the following error:
        HANDLER THREAD PROBLEM: java.lang.NullPointerException
        java.lang.NullPointerException
        at java.util.Hashtable.put(Hashtable.java:381)
        at org.apache.tomcat.core.Request.setAttribute(Request.java:183)
        at org.apache.tomcat.core.HttpServletRequestFacade.setAttribute(HttpServletRequestFacade.java:110)
        at org.apache.tomcat.core.ServletWrapper.handleException(ServletWrapper.java:457)
        at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:413)
        at org.apache.tomcat.core.Context.handleRequest(Context.java:648)
        at org.apache.tomcat.server.ConnectionHandler.run(ConnectionHandler.java:205)

thanks in advance,

linh ...

Re: session expiring too quick

Posted by Gary Yang <yg...@yahoo.com>.
Gary Yang wrote:

> Shachor Gal wrote:
>
> >  I think that I fixed this problem yesterday. So if you will use todays
> > build it supposed to be there.
> >
> > However, the defaultSessionTimeOut in server.xml is not in use anymore,
> > instead you will need to set the session timeout in web.xml (The servlet
> > API 2.2 deployment descriptor.)
> >
> > Note that you can use TOMCAT_HOME/conf/web.xml to provide default timeout
> > for all the contexts.
> >
> > Tell me if it works (remember this should be in the latest build).
> >
> >         Gal Shachor
> >
> > On Fri, 3 Mar 2000, Eric Lebetsamer wrote:
> >
> > > I noticed this same problem.  I assumed that it is a bug in 3.1.  I had to
> > > move backwards to 3.0 to fix the problem.  Waiting for a fix.
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
> Why the minium timeout is 60 seconds? From
> src/share/org/apache/tomcat/session/StandardManager.java,
>  it seems that tomcat checks all sessions each 60 seconds. Why don't you check if
> a session is time out when a new access comes?
> I mean, why don't you check it in method access() of StandardManager.java?

Sorry, here should be StandardSession.java.

>
>     public void access() {
>
>         this.lastAccessedTime = this.thisAccessedTime;
>         this.thisAccessedTime = System.currentTimeMillis();
>         this.isNew=false;
>
>         if (this.thisAccessedTime-this.lastAccessedTime >
> this.maxInactiveInterval) {
>             // timeout ....
>
>         }
>   }
>
> If use this method, the minium maxInactiveInterval can be less than 60...the unit
> can even be ms:-)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org



Re: session expiring too quick

Posted by Gary Yang <yg...@yahoo.com>.
Shachor Gal wrote:

>  I think that I fixed this problem yesterday. So if you will use todays
> build it supposed to be there.
>
> However, the defaultSessionTimeOut in server.xml is not in use anymore,
> instead you will need to set the session timeout in web.xml (The servlet
> API 2.2 deployment descriptor.)
>
> Note that you can use TOMCAT_HOME/conf/web.xml to provide default timeout
> for all the contexts.
>
> Tell me if it works (remember this should be in the latest build).
>
>         Gal Shachor
>
> On Fri, 3 Mar 2000, Eric Lebetsamer wrote:
>
> > I noticed this same problem.  I assumed that it is a bug in 3.1.  I had to
> > move backwards to 3.0 to fix the problem.  Waiting for a fix.
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

Why the minium timeout is 60 seconds? From
src/share/org/apache/tomcat/session/StandardManager.java,
 it seems that tomcat checks all sessions each 60 seconds. Why don't you check if
a session is time out when a new access comes?
I mean, why don't you check it in method access() of StandardManager.java?
    public void access() {

        this.lastAccessedTime = this.thisAccessedTime;
        this.thisAccessedTime = System.currentTimeMillis();
        this.isNew=false;

        if (this.thisAccessedTime-this.lastAccessedTime >
this.maxInactiveInterval) {
            // timeout ....

        }
  }

If use this method, the minium maxInactiveInterval can be less than 60...the unit
can even be ms:-)





Re: session expiring too quick

Posted by Shachor Gal <sh...@techunix.technion.ac.il>.
 I think that I fixed this problem yesterday. So if you will use todays
build it supposed to be there.

However, the defaultSessionTimeOut in server.xml is not in use anymore,
instead you will need to set the session timeout in web.xml (The servlet
API 2.2 deployment descriptor.)

Note that you can use TOMCAT_HOME/conf/web.xml to provide default timeout
for all the contexts.

Tell me if it works (remember this should be in the latest build).

	Gal Shachor

On Fri, 3 Mar 2000, Eric Lebetsamer wrote:

> I noticed this same problem.  I assumed that it is a bug in 3.1.  I had to
> move backwards to 3.0 to fix the problem.  Waiting for a fix.
> 
> --Erc
> 
> ----- Original Message -----
> From: Brennan O'Shea <Br...@alltel.com>
> To: <to...@jakarta.apache.org>
> Sent: Friday, March 03, 2000 1:03 PM
> Subject: session expiring too quick
> 
> 
> > To anyone who can help:
> >
> > I'm running Tomcat 3.1 in NT environment.  I have the following settings
> in my
> > "server.xml" file:
> > defaultSessionTimeOut="500"
> >
> > and the following in "server.dtd":
> > defaultSessionTimeOut NMTOKEN "500"
> >
> > and my sessions time out in just a few minutes (apx. 2-3 minutes).  These
> were
> > originally set to "30" and I changed them to "500" and haven't noticed any
> > change.  Can someone tell me if this is in fact the setting to change in
> order
> > to increase the default session timeout and also what units (minutes) this
> > number is in.  Has anyone else had this problem?
> >
> > Thanks,
> > Brennan
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 
> 


Re: session expiring too quick

Posted by Eric Lebetsamer <ed...@hotmail.com>.
I noticed this same problem.  I assumed that it is a bug in 3.1.  I had to
move backwards to 3.0 to fix the problem.  Waiting for a fix.

--Erc

----- Original Message -----
From: Brennan O'Shea <Br...@alltel.com>
To: <to...@jakarta.apache.org>
Sent: Friday, March 03, 2000 1:03 PM
Subject: session expiring too quick


> To anyone who can help:
>
> I'm running Tomcat 3.1 in NT environment.  I have the following settings
in my
> "server.xml" file:
> defaultSessionTimeOut="500"
>
> and the following in "server.dtd":
> defaultSessionTimeOut NMTOKEN "500"
>
> and my sessions time out in just a few minutes (apx. 2-3 minutes).  These
were
> originally set to "30" and I changed them to "500" and haven't noticed any
> change.  Can someone tell me if this is in fact the setting to change in
order
> to increase the default session timeout and also what units (minutes) this
> number is in.  Has anyone else had this problem?
>
> Thanks,
> Brennan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
>

Re: session expiring too quick

Posted by Gary Yang <yg...@yahoo.com>.
Brennan O'Shea wrote:

> To anyone who can help:
>
> I'm running Tomcat 3.1 in NT environment.  I have the following settings in my
> "server.xml" file:
> defaultSessionTimeOut="500"
>
> and the following in "server.dtd":
> defaultSessionTimeOut NMTOKEN "500"
>
> and my sessions time out in just a few minutes (apx. 2-3 minutes).  These were
> originally set to "30" and I changed them to "500" and haven't noticed any
> change.  Can someone tell me if this is in fact the setting to change in order
> to increase the default session timeout and also what units (minutes) this
> number is in.  Has anyone else had this problem?
>
> Thanks,
> Brennan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org

Get the latest build.

In my web.xml, the default timeout is 30 (minutes),
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>


so http://localhost:8080/examples/servlet/SnoopServlet
returns:
...
Session Last Accessed Time: 952123105698
Session Max Inactive Interval Seconds: 1800
...

When I change it to 60, the result is:
...
Session Last Accessed Time: 952123188568
Session Max Inactive Interval Seconds: 3600
...

Also, you can set your own timeout interval in your servlet or jsp. Here is a
sample:
<HTML>
<HEAD>
        <TITLE>JSP session page</TITLE>
</HEAD>
<BODY>
<%
    session.setMaxInactiveInterval(60);
%>
</BODY>
</HTML>

Here, 60's unit is second.