Ben,
Thanks for the reply. But I'm still unclear on why setting the timeout won't work
for my situation. What is the difference between an effectively idle session timing
out, and "cancelling" a request?
Of course I agree that fixing the root problem would be preferable, but it's extremely
hard to diagnose. Putting in println's everywhere would in my case generate huge log
file sizes, and I'll only try that as a last resort.
Can anyone suggest a different technique for simulating an "inactive" session, so that
I can get <session-timeout> to work?
thanks,
-Ron
----------------------
Ben Souther wrote:
JSP/Servlet technology uses a solution called the HttpSession to overcome the
limitations of the stateless HTTP protocol.
Tomcat uses cookies to map a particular web user to his/her session object.
The developer can bind objects to a user's session object and then retrieve
them on subsequent hits from that user's browser. The session-timeout
attribute allows you to explicitly set the length of your webapps sessions.
The default is 30 mins.
You're trying cancel a particular request. I don't think that can be done in
tomcat (someone will correct me if I'm wrong). Even if it could, it would be
better to get to the root of the problem and fix that.
Try putting a bunch of System.out.println(" .... ") statements in your code,
tail the catalina log, and hit your app to find out which line of code is
causing it to hang.
The catalina.log file is in TOMCAT_HOME/logs. All standard out and standard
error messages get routed to there by default.
The Unix tail command with the -f option will allow you to watch the logfile
as it is being written to, in real time.
-Ben
--------------------
Original message:
Hi,
I'm a relatively new Tomcat user, running 4.0.4 (testing on Windows, deploying on
Sun UNIX). The UNIX servlet is having rare problems "hanging", for which the exact
cause is unknown.
I'm trying to see if a session timeout can solve the problem, but have not been able
to get it to work. Numerous archives talk about this, and it seems like I'm doing
what everyone suggests, but it's not working.
In my web.xml file, I have the following, as a test of one-minute timeout:
<session-config>
<session-timeout>1</session-timeout>
</session-config>
I have made a call the HttpSession.getMaxInactiveInterval, and it returns 60 (seconds,
I presume), so I believe the parameter is being applied. I have tried 2 different
approaches to simulate an "inactive" server:
1) Manually update a database row (but don't commit) before the servlet call, then
have the servlet try to update the same row
2) Use Thread.sleep(120000)
In both cases, the 1 minute timeout doesn't do anything. So what constitutes an
"inactive" session, for which this parameter was designed? If it likely won't solve
my problem, does anyone have an idea on how I can kill the request after a given
amount of time?
much thanks,
-Ron
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]