Are you sure it's the _session_ timeout, not the browser's connection
timeout?

The session timeout defaults to 30 minutes.  That should be plenty of time
to load anything, even a Word document at 9600 baud,...

More likely, the browser is timing out when it doesn't get a response
quickly enough.  There are several things you could do for this:

1) Do some profiling on your code to find out why it's taking a long time to
process the data.  One profiler is jprof, which comes with the Sun JDK (see
the Sun webpage, at http://java.sun.com/j2se/, for more info).  Others are
JProbe (www.jprobe.com) and JInsight
(http://www.alphaworks.ibm.com/tech/jinsight).

2) If processing the file must take a long time, don't do it while the
browser is waiting.  Instead, fork a new thread to do the processing, and
return a web page immediately.

3) If you can't do that, at least return _some_ of the page
immediately--say, a header saying that you're working on it.  Call flush()
on the output stream before starting the processing.  (Note that this isn't
guaranteed to work--the servlet engine or the network layer might buffer the
page until you write a ton of data, or you close the connection.  But it
works on my PC running Tomcat and IE locally.)

                                        -- Bill K. 


-----Original Message-----
From: Tal Dayan [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 11, 2001 1:30 PM
To: [EMAIL PROTECTED]
Subject: Session timeout during long file upload



Hello,

When we try to upload a long file to a servlet we encounters a problem with
the session
timeout because of the long time it takes to upload the file over a slow
connection (sometimes
several hours).

It seems that the problem is in the way the session timeout is specified in
the servlet
session. It measures time between request, not just idle time (no activity
related to
that session).

A possible solution would be to increase the session timeout to several
hours but
this will affect also affect the automatic logout of users
after a predefined idle time period (by the automatic invalidation of the
session).

Is there a way to reset the session timer as if a new request has arrived ?
With this option, we could add to the loop that reads the incoming files a
periodic
call that will reset the session timeout (watchdog).

Thanks,

Tal

Reply via email to