tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: Objects lost in session
Date Tue, 30 Sep 2003 19:37:16 GMT

Strange indeed.  When things like this happen and you can't reproduce
them reliably, I tend to think of two always-present possible evils:

1. Thread safety: what happens if you make all the relevant methods
synchronized?  Shouldn't make much of a difference here since a request
is being served by one thread, but still worth trying.

2. GC?  If your system is really stressed when these errors happened,
this is worth investigating.  Perhaps the collector is collection your
session prematurely.  Again, theoretically unlikely if not impossible,
but those are the types of things that tend to happen under high stress.

You can use a load-testing tool (e.g. JMeter) to simulate high load on
your dev server, or alternatively to just run multiple concurrent tests
in order to look for thread-safety-related bugs.

Yoav Shapira
Millennium ChemInformatics

>-----Original Message-----
>From: Tim Odowd []
>Sent: Tuesday, September 30, 2003 2:12 PM
>To: ''
>Subject: Objects lost in session
>Sorry for the long email.
>I am using Tomcat 4.124 for my servlet engine and IIS for my web
>I am monitoring exceptions that occur in my system and this one has me
>confused.  The exception is:
>	at ParentClass.getQualificationMessage(
>	at ChildClass.finishDocumentUpload(
>	at ...
>The parent class method is failing when it tries to call a method on
>Position object that it retrieved from the session.
>It looks like the Position object is null in the session:
>    protected static final String getQualificationMessage(
>            HttpServletRequest request){
>        HttpSession session = request.getSession();
>        int employerId =
>        		.intValue();
>(483)        int positionId
>                =
>		...
>What I can't explain is that the ChildClass method that has called the
>method was able to retrieve the position object from the session and
call a
>method on it.  That makes me believe that the position object existed
>session at that time:
>I have a Position object stored as a session attribute with the
>    protected static final String finishDocumentUpload(
>            HttpServletRequest request, EmployerConfiguration ec){
>        HttpSession session =request.getSession();
>        Position position =
>        if (position.attachDocumentsOnly()){
>        	return 	forwardToOriginalPage(request, ec);
>        } else {
>135	   	return getQualificationMessage(request);
>		}
>    }
>I cannot reproduce this error (which is making me crazy), but I see
>things happening every once in a while in my exception log.
>Any ideas?
>Thanks for your help,

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

View raw message