You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tyson Nunemacher <nu...@mho.com> on 2005/01/13 21:09:48 UTC

Sporadic Session Bug

Hi folks,

I'm running a Java/J2EE/EJB (stateless, no CMP) app on Jonas 4.1.2 with 
embedded Tomcat 5.0 and Struts 1.2.  My problem also existed when I used 
to run the app in JBoss 3.2.2 with embedded Tomcat 4.1 and Struts 1.0. 
We're currently using Java 1.4.2_04 from Sun.

The issue is that our app will from time to time lose track of an 
existing session for a split second.  We use Java sessions to store only 
a GUID, which is then used to access a wealth of session-specific info 
stored in database tables.  One way the bug manifests itself is the user 
will be cruising along, happily retrieving session info, when all of a 
sudden, a page will come up blank.  If the user refreshes the page, 
forcing another request, the old session will be retrieved and the 
proper data displayed.  It doesn't create a new session on the second 
request.  We also use Tiles, and when a tileset loads, occasionally a 
random single tile will through a servlet exception stemming from not 
being able to find the session.  Again, a refresh makes it go away.

A couple clues:

1.) Though we've rolled our own session system to a large extent, I've 
traced the issue through painstaking debugging to a request.getSession() 
call which can return a valid session object one moment, null the next, 
then the same valid session object directly after that.  The function 
which makes this call is used by nearly every request handler (Struts 
action), and works most of the time.

2.) Null sessions seem to turn up with more frequency when our system 
resources are being stressed.

This has been a problem for us for a long time, but one we've been able 
to live with because it's sporadic and we have a reasonably 
understanding user base.  ;)  But it's also a tricky one, as it doesn't 
appear to be a problem directly with our code.  It's possible that it's 
a configuration issue, or we're abusing a feature we shouldn't be, or... 
    You get the idea.  And I'm not sure if it's a Struts issue or a 
Tomcat issue or something else.  It's apparently not our EJB container, 
as it shows up in both JBoss and Jonas.

I haven't found much on Google regarding session objects going randomly 
null when they legitimately exist both before and after.  I can include 
a code snippet if you think it'll help, but it's run of the mill 
"request.getSession().getAttribute("xxx")" stuff.

Any ideas?

Thanks in advance,
Tyson

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org