Hi Geoff,

Things have become slightly more interesting; I did as you suggest and I put a timeout extension in awake() and restore it to normal in sleep(), however, it seems that our REAL problem is the 'soft' timeout that occurs when an idle session is serialized to disk. I have code that goes through our DB pool and closes off connections that are unique to the user when the session is written to disk, and this is running in the middle of the processing. Is there a similar technique to temporarily disable/extend the serialization?

Thanks
Chris Backas


Chris Backas wrote:
Hello all,

We have an installation of WebWare that's configured to have a 15
minute session timeout period.  In some extreme circumstances though,
a servlet request can occur that takes longer than this to process
(due to very involved database work involving a great many
operations).

My question is, does webware's session sweeper erase a session that's
passed its timeout period while it still hasn't finished its last
request?  We've gotten some odd behaviors in this situation and are
beginning to suspect this might be the case.   Can I disable a
particular session's time when I know that they're in an area
that may
result in this condition?  (It's a specific aspect of a specific
servlet that's not frequently used in this way)


You are right I think. The session sweeper only cares about the last time
the session was accessed, and even if a servlet is still running, if it
hasn't accessed the session in 15 minutes because it's doing database
processing, then the session will get wiped out.

There are other ways to get these "session race conditions" too. If a user
logs out, your logout code may clear out the session variables. But if
there was another request still running in that session, it may suddenly see
the session get cleared out while it is processing, potentially resulting in
tracebacks or other misbehavior that the actual user never sees, but that
still may be emailed to the administrator if WebKit is configured to do so.

Anyhow, back to your issue, session objects have a timeout() method to get
the timeout in seconds and a setTimeout() method to set the timeout. So you
should just be able to change the timeout temporarily with something like
this (completely untested):

    old_timeout = self.session().timeout()
    self.session().setTimeout(new_timeout)
    try:
        # long-running code goes here...
    finally:
        self.session().setTimeout(old_timeout)

- Geoff

Attachment: PGP.sig
Description: PGP signature



Reply via email to